mirror of
https://github.com/plankanban/planka.git
synced 2025-12-27 01:11:50 +03:00
feat: Open card once created with Ctrl+Enter (#373)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { call, put, select } from 'redux-saga/effects';
|
||||
|
||||
import { goToBoard } from './router';
|
||||
import { goToBoard, goToCard } from './router';
|
||||
import request from '../request';
|
||||
import selectors from '../../../selectors';
|
||||
import actions from '../../../actions';
|
||||
import api from '../../../api';
|
||||
import { createLocalId } from '../../../utils/local-id';
|
||||
|
||||
export function* createCard(listId, data) {
|
||||
export function* createCard(listId, data, autoOpen) {
|
||||
const { boardId } = yield select(selectors.selectListById, listId);
|
||||
|
||||
const nextData = {
|
||||
@@ -35,6 +35,10 @@ export function* createCard(listId, data) {
|
||||
}
|
||||
|
||||
yield put(actions.createCard.success(localId, card));
|
||||
|
||||
if (autoOpen) {
|
||||
yield call(goToCard, card.id);
|
||||
}
|
||||
}
|
||||
|
||||
export function* handleCardCreate(card) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
|
||||
|
||||
export default function* cardsWatchers() {
|
||||
yield all([
|
||||
takeEvery(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data } }) =>
|
||||
services.createCard(listId, data),
|
||||
takeEvery(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data, autoOpen } }) =>
|
||||
services.createCard(listId, data, autoOpen),
|
||||
),
|
||||
takeEvery(EntryActionTypes.CARD_CREATE_HANDLE, ({ payload: { card } }) =>
|
||||
services.handleCardCreate(card),
|
||||
|
||||
Reference in New Issue
Block a user