@atlaskit/editor-core 187.39.4 → 187.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.40.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`da6dac74c66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da6dac74c66) - Fix libra testing.
8
+
9
+ ## 187.40.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`705d8ec0641`](https://bitbucket.org/atlassian/atlassian-frontend/commits/705d8ec0641) - [ux] Added a new shortcut (⌘ + Opt + ⏎) for Check/Uncheck Action item
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 187.39.4
4
20
 
5
21
  ### Patch Changes
@@ -495,6 +495,12 @@ Object.defineProperty(exports, "toggleTable", {
495
495
  return _keymaps.toggleTable;
496
496
  }
497
497
  });
498
+ Object.defineProperty(exports, "toggleTaskItemCheckbox", {
499
+ enumerable: true,
500
+ get: function get() {
501
+ return _keymaps.toggleTaskItemCheckbox;
502
+ }
503
+ });
498
504
  Object.defineProperty(exports, "toggleUnderline", {
499
505
  enumerable: true,
500
506
  get: function get() {
@@ -55,6 +55,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
55
55
  defaultMessage: 'Paste plain text',
56
56
  description: ''
57
57
  },
58
+ CheckUncheckActionItem: {
59
+ id: 'fabric.editor.checkUncheckActionItem',
60
+ defaultMessage: 'Toggle action item',
61
+ description: 'For Check/Uncheck Action item use shortcut'
62
+ },
58
63
  altText: {
59
64
  id: 'fabric.editor.altText',
60
65
  defaultMessage: 'Alt text',
@@ -386,6 +391,12 @@ var otherFormatting = function otherFormatting(_ref3) {
386
391
  keymap: function keymap() {
387
392
  return _keymaps.addInlineComment;
388
393
  }
394
+ }, {
395
+ name: formatMessage(messages.CheckUncheckActionItem),
396
+ type: 'checkbox',
397
+ keymap: function keymap() {
398
+ return _keymaps.toggleTaskItemCheckbox;
399
+ }
389
400
  }];
390
401
  };
391
402
  var imageAutoFormat = {
@@ -445,6 +456,11 @@ var getComponentFromKeymap = function getComponentFromKeymap(keymap) {
445
456
  css: _styles.codeLg,
446
457
  key: "".concat(keyParts, "-").concat(index)
447
458
  }, part);
459
+ } else if (part.toLowerCase() === 'enter') {
460
+ return (0, _react2.jsx)("span", {
461
+ css: _styles.codeSm,
462
+ key: "".concat(keyParts, "-").concat(index)
463
+ }, '⏎');
448
464
  }
449
465
  return (0, _react2.jsx)("span", {
450
466
  css: _styles.codeSm,
@@ -11,6 +11,7 @@ var _commands = require("@atlaskit/editor-prosemirror/commands");
11
11
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
12
12
  var _model = require("@atlaskit/editor-prosemirror/model");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _steps = require("@atlaskit/adf-schema/steps");
14
15
  var _utils = require("@atlaskit/editor-prosemirror/utils");
15
16
  var _adfSchema = require("@atlaskit/adf-schema");
16
17
  var _utils2 = require("@atlaskit/editor-common/utils");
@@ -19,6 +20,7 @@ var _commands2 = require("../commands");
19
20
  var _commands3 = require("./commands");
20
21
  var _helpers = require("./helpers");
21
22
  var _utils3 = require("../utils");
23
+ var _keymaps = require("../../../keymaps");
22
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
26
  var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction, inputMethod) {
@@ -314,6 +316,26 @@ var enter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, (0,
314
316
  }
315
317
  return true;
316
318
  }));
319
+ var cmdOptEnter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
320
+ var selection = state.selection,
321
+ schema = state.schema;
322
+ var taskItem = schema.nodes.taskItem;
323
+ var $from = selection.$from;
324
+ var node = $from.node($from.depth);
325
+ var nodeType = node && node.type;
326
+ var nodePos = $from.before($from.depth);
327
+ if (nodeType === taskItem) {
328
+ var tr = state.tr;
329
+ tr.step(new _steps.SetAttrsStep(nodePos, {
330
+ state: node.attrs.state === 'TODO' ? 'DONE' : 'TODO',
331
+ localId: node.attrs.localId
332
+ }));
333
+ if (tr && dispatch) {
334
+ dispatch(tr);
335
+ }
336
+ }
337
+ return true;
338
+ });
317
339
  function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
318
340
  var indentHandlers = {
319
341
  'Shift-Tab': (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
@@ -331,12 +353,12 @@ function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
331
353
  'Shift-Tab': _helpers.isInsideTaskOrDecisionItem,
332
354
  Tab: _helpers.isInsideTaskOrDecisionItem
333
355
  } : {};
334
- var keymaps = _objectSpread({
356
+ var keymaps = _objectSpread((0, _defineProperty2.default)({
335
357
  Backspace: backspace,
336
358
  Delete: deleteForwards,
337
359
  'Ctrl-d': deleteForwards,
338
360
  Enter: enter
339
- }, allowNestedTasks ? indentHandlers : defaultHandlers);
361
+ }, _keymaps.toggleTaskItemCheckbox.common, cmdOptEnter), allowNestedTasks ? indentHandlers : defaultHandlers);
340
362
  return (0, _keymap.keymap)(keymaps);
341
363
  }
342
364
  var _default = keymapPlugin;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.39.4";
9
+ var version = "187.40.1";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1 +1 @@
1
- export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP } from '@atlaskit/editor-common/keymaps';
1
+ export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, toggleTaskItemCheckbox, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP } from '@atlaskit/editor-common/keymaps';
@@ -7,7 +7,7 @@ import { browser } from '@atlaskit/editor-common/utils';
7
7
  import CrossIcon from '@atlaskit/icon/glyph/cross';
8
8
  import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
9
9
  import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
10
- import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
10
+ import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleTaskItemCheckbox, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
11
11
  import ToolbarButton from '../../../ui/ToolbarButton';
12
12
  import { toolbarMessages, listMessages } from '@atlaskit/editor-common/messages';
13
13
  import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
@@ -43,6 +43,11 @@ const messages = defineMessages({
43
43
  defaultMessage: 'Paste plain text',
44
44
  description: ''
45
45
  },
46
+ CheckUncheckActionItem: {
47
+ id: 'fabric.editor.checkUncheckActionItem',
48
+ defaultMessage: 'Toggle action item',
49
+ description: 'For Check/Uncheck Action item use shortcut'
50
+ },
46
51
  altText: {
47
52
  id: 'fabric.editor.altText',
48
53
  defaultMessage: 'Alt text',
@@ -277,6 +282,10 @@ const otherFormatting = ({
277
282
  name: formatMessage(annotationMessages.createComment),
278
283
  type: 'annotation',
279
284
  keymap: () => addInlineComment
285
+ }, {
286
+ name: formatMessage(messages.CheckUncheckActionItem),
287
+ type: 'checkbox',
288
+ keymap: () => toggleTaskItemCheckbox
280
289
  }];
281
290
  const imageAutoFormat = {
282
291
  name: 'Image',
@@ -327,6 +336,11 @@ export const getComponentFromKeymap = keymap => {
327
336
  css: codeLg,
328
337
  key: `${keyParts}-${index}`
329
338
  }, part);
339
+ } else if (part.toLowerCase() === 'enter') {
340
+ return jsx("span", {
341
+ css: codeSm,
342
+ key: `${keyParts}-${index}`
343
+ }, '⏎');
330
344
  }
331
345
  return jsx("span", {
332
346
  css: codeSm,
@@ -2,6 +2,7 @@ import { autoJoin, chainCommands } from '@atlaskit/editor-prosemirror/commands';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
3
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
6
  import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
6
7
  import { uuid } from '@atlaskit/adf-schema';
7
8
  import { filterCommand as filter, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
@@ -10,6 +11,7 @@ import { insertTaskDecisionWithAnalytics } from '../commands';
10
11
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
11
12
  import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, walkOut, getTaskItemIndex, isInsideDecision, isTable } from './helpers';
12
13
  import { normalizeTaskItemsSelection } from '../utils';
14
+ import { toggleTaskItemCheckbox } from '../../../keymaps';
13
15
  const indentationAnalytics = (curIndentLevel, direction, inputMethod) => ({
14
16
  action: ACTION.FORMATTED,
15
17
  actionSubject: ACTION_SUBJECT.TEXT,
@@ -312,6 +314,32 @@ const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTas
312
314
  }
313
315
  return true;
314
316
  }));
317
+ const cmdOptEnter = filter(isInsideTaskOrDecisionItem, (state, dispatch) => {
318
+ const {
319
+ selection,
320
+ schema
321
+ } = state;
322
+ const {
323
+ taskItem
324
+ } = schema.nodes;
325
+ const {
326
+ $from
327
+ } = selection;
328
+ const node = $from.node($from.depth);
329
+ const nodeType = node && node.type;
330
+ const nodePos = $from.before($from.depth);
331
+ if (nodeType === taskItem) {
332
+ const tr = state.tr;
333
+ tr.step(new SetAttrsStep(nodePos, {
334
+ state: node.attrs.state === 'TODO' ? 'DONE' : 'TODO',
335
+ localId: node.attrs.localId
336
+ }));
337
+ if (tr && dispatch) {
338
+ dispatch(tr);
339
+ }
340
+ }
341
+ return true;
342
+ });
315
343
  export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
316
344
  const indentHandlers = {
317
345
  'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => getUnindentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs),
@@ -326,6 +354,7 @@ export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
326
354
  Delete: deleteForwards,
327
355
  'Ctrl-d': deleteForwards,
328
356
  Enter: enter,
357
+ [toggleTaskItemCheckbox.common]: cmdOptEnter,
329
358
  ...(allowNestedTasks ? indentHandlers : defaultHandlers)
330
359
  };
331
360
  return keymap(keymaps);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.39.4";
2
+ export const version = "187.40.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1 +1 @@
1
- export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP } from '@atlaskit/editor-common/keymaps';
1
+ export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, toggleTaskItemCheckbox, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP } from '@atlaskit/editor-common/keymaps';
@@ -8,7 +8,7 @@ import { browser } from '@atlaskit/editor-common/utils';
8
8
  import CrossIcon from '@atlaskit/icon/glyph/cross';
9
9
  import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
10
10
  import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
11
- import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
11
+ import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleTaskItemCheckbox, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
12
12
  import ToolbarButton from '../../../ui/ToolbarButton';
13
13
  import { toolbarMessages, listMessages } from '@atlaskit/editor-common/messages';
14
14
  import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
@@ -44,6 +44,11 @@ var messages = defineMessages({
44
44
  defaultMessage: 'Paste plain text',
45
45
  description: ''
46
46
  },
47
+ CheckUncheckActionItem: {
48
+ id: 'fabric.editor.checkUncheckActionItem',
49
+ defaultMessage: 'Toggle action item',
50
+ description: 'For Check/Uncheck Action item use shortcut'
51
+ },
47
52
  altText: {
48
53
  id: 'fabric.editor.altText',
49
54
  defaultMessage: 'Alt text',
@@ -374,6 +379,12 @@ var otherFormatting = function otherFormatting(_ref3) {
374
379
  keymap: function keymap() {
375
380
  return addInlineComment;
376
381
  }
382
+ }, {
383
+ name: formatMessage(messages.CheckUncheckActionItem),
384
+ type: 'checkbox',
385
+ keymap: function keymap() {
386
+ return toggleTaskItemCheckbox;
387
+ }
377
388
  }];
378
389
  };
379
390
  var imageAutoFormat = {
@@ -432,6 +443,11 @@ export var getComponentFromKeymap = function getComponentFromKeymap(keymap) {
432
443
  css: codeLg,
433
444
  key: "".concat(keyParts, "-").concat(index)
434
445
  }, part);
446
+ } else if (part.toLowerCase() === 'enter') {
447
+ return jsx("span", {
448
+ css: codeSm,
449
+ key: "".concat(keyParts, "-").concat(index)
450
+ }, '⏎');
435
451
  }
436
452
  return jsx("span", {
437
453
  css: codeSm,
@@ -5,6 +5,7 @@ import { autoJoin, chainCommands } from '@atlaskit/editor-prosemirror/commands';
5
5
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
7
7
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
8
+ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
8
9
  import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
9
10
  import { uuid } from '@atlaskit/adf-schema';
10
11
  import { filterCommand as filter, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
@@ -13,6 +14,7 @@ import { insertTaskDecisionWithAnalytics } from '../commands';
13
14
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
14
15
  import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, walkOut, getTaskItemIndex, isInsideDecision, isTable } from './helpers';
15
16
  import { normalizeTaskItemsSelection } from '../utils';
17
+ import { toggleTaskItemCheckbox } from '../../../keymaps';
16
18
  var indentationAnalytics = function indentationAnalytics(curIndentLevel, direction, inputMethod) {
17
19
  return {
18
20
  action: ACTION.FORMATTED,
@@ -304,6 +306,26 @@ var enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskD
304
306
  }
305
307
  return true;
306
308
  }));
309
+ var cmdOptEnter = filter(isInsideTaskOrDecisionItem, function (state, dispatch) {
310
+ var selection = state.selection,
311
+ schema = state.schema;
312
+ var taskItem = schema.nodes.taskItem;
313
+ var $from = selection.$from;
314
+ var node = $from.node($from.depth);
315
+ var nodeType = node && node.type;
316
+ var nodePos = $from.before($from.depth);
317
+ if (nodeType === taskItem) {
318
+ var tr = state.tr;
319
+ tr.step(new SetAttrsStep(nodePos, {
320
+ state: node.attrs.state === 'TODO' ? 'DONE' : 'TODO',
321
+ localId: node.attrs.localId
322
+ }));
323
+ if (tr && dispatch) {
324
+ dispatch(tr);
325
+ }
326
+ }
327
+ return true;
328
+ });
307
329
  export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
308
330
  var indentHandlers = {
309
331
  'Shift-Tab': filter([isInsideTaskOrDecisionItem, function (state) {
@@ -321,12 +343,12 @@ export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
321
343
  'Shift-Tab': isInsideTaskOrDecisionItem,
322
344
  Tab: isInsideTaskOrDecisionItem
323
345
  } : {};
324
- var keymaps = _objectSpread({
346
+ var keymaps = _objectSpread(_defineProperty({
325
347
  Backspace: backspace,
326
348
  Delete: deleteForwards,
327
349
  'Ctrl-d': deleteForwards,
328
350
  Enter: enter
329
- }, allowNestedTasks ? indentHandlers : defaultHandlers);
351
+ }, toggleTaskItemCheckbox.common, cmdOptEnter), allowNestedTasks ? indentHandlers : defaultHandlers);
330
352
  return keymap(keymaps);
331
353
  }
332
354
  export default keymapPlugin;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.39.4";
2
+ export var version = "187.40.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,2 +1,2 @@
1
- export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from '@atlaskit/editor-common/keymaps';
1
+ export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, toggleTaskItemCheckbox, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from '@atlaskit/editor-common/keymaps';
2
2
  export type { Keymap } from '@atlaskit/editor-common/keymaps';
@@ -1,14 +1,12 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import { pluginKey } from './pm-plugins/plugin-key';
3
3
  import type { LayoutPluginOptions } from './types';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
6
  export { pluginKey };
7
- declare const layoutPlugin: NextEditorPlugin<'layout', {
7
+ export type LayoutPlugin = NextEditorPlugin<'layout', {
8
8
  pluginConfiguration: LayoutPluginOptions | undefined;
9
- dependencies: [
10
- typeof decorationsPlugin,
11
- OptionalPlugin<typeof analyticsPlugin>
12
- ];
9
+ dependencies: [DecorationsPlugin, OptionalPlugin<AnalyticsPlugin>];
13
10
  }>;
11
+ declare const layoutPlugin: LayoutPlugin;
14
12
  export default layoutPlugin;
@@ -1,2 +1,2 @@
1
- export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from '@atlaskit/editor-common/keymaps';
1
+ export { addAltText, navToEditorToolbar, navToFloatingToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleCode, pastePlainText, clearFormatting, setNormalText, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, toggleTaskItemCheckbox, ctrlBackSpace, toggleBulletList, toggleBlockQuote, insertNewLine, shiftBackspace, splitCodeBlock, splitListItem, insertRule, undo, moveUp, moveDown, moveLeft, moveRight, indentList, outdentList, redo, openHelp, addLink, addInlineComment, submit, enter, shiftEnter, tab, indent, outdent, backspace, deleteKey, forwardDelete, space, escape, nextCell, previousCell, shiftTab, toggleTable, addRowBefore, addRowAfter, addColumnAfter, addColumnBefore, cut, copy, paste, altPaste, find, alignLeft, tooltip, ToolTipContent, findKeymapByDescription, findShortcutByDescription, findShortcutByKeymap, makeKeymap, makeKeyMapWithCommon, bindKeymapWithCommand, findKeyMapForBrowser, DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from '@atlaskit/editor-common/keymaps';
2
2
  export type { Keymap } from '@atlaskit/editor-common/keymaps';
@@ -1,14 +1,15 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import { pluginKey } from './pm-plugins/plugin-key';
3
3
  import type { LayoutPluginOptions } from './types';
4
- import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
6
  export { pluginKey };
7
- declare const layoutPlugin: NextEditorPlugin<'layout', {
7
+ export type LayoutPlugin = NextEditorPlugin<'layout', {
8
8
  pluginConfiguration: LayoutPluginOptions | undefined;
9
9
  dependencies: [
10
- typeof decorationsPlugin,
11
- OptionalPlugin<typeof analyticsPlugin>
10
+ DecorationsPlugin,
11
+ OptionalPlugin<AnalyticsPlugin>
12
12
  ];
13
13
  }>;
14
+ declare const layoutPlugin: LayoutPlugin;
14
15
  export default layoutPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.39.4",
3
+ "version": "187.40.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.9.0",
58
- "@atlaskit/editor-common": "^74.56.0",
58
+ "@atlaskit/editor-common": "^74.57.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
@@ -108,12 +108,12 @@
108
108
  "@atlaskit/radio": "^5.6.0",
109
109
  "@atlaskit/section-message": "^6.4.0",
110
110
  "@atlaskit/select": "^16.5.0",
111
- "@atlaskit/smart-card": "^26.22.0",
111
+ "@atlaskit/smart-card": "^26.23.0",
112
112
  "@atlaskit/smart-user-picker": "^6.3.0",
113
113
  "@atlaskit/spinner": "^15.5.0",
114
114
  "@atlaskit/status": "^1.3.0",
115
115
  "@atlaskit/tabs": "^13.4.0",
116
- "@atlaskit/task-decision": "^17.7.0",
116
+ "@atlaskit/task-decision": "^17.8.0",
117
117
  "@atlaskit/textarea": "^4.7.0",
118
118
  "@atlaskit/textfield": "^5.6.0",
119
119
  "@atlaskit/theme": "^12.6.0",