@atlaskit/editor-core 188.11.4 → 188.12.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.
Files changed (116) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/labs/next/presets/universal.js +15 -3
  3. package/dist/cjs/plugins/annotation/index.js +12 -1
  4. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -1
  5. package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
  6. package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +2 -1
  7. package/dist/cjs/plugins/annotation/toolbar.js +2 -156
  8. package/dist/cjs/plugins/index.js +0 -7
  9. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
  10. package/dist/cjs/plugins/layout/actions.js +20 -17
  11. package/dist/cjs/plugins/layout/index.js +6 -2
  12. package/dist/cjs/plugins/panel/index.js +1 -1
  13. package/dist/cjs/plugins/panel/toolbar.js +9 -7
  14. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +0 -6
  15. package/dist/cjs/plugins/rank.js +1 -1
  16. package/dist/cjs/plugins/tasks-and-decisions/index.js +1 -1
  17. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
  18. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
  19. package/dist/cjs/plugins/undo-redo/index.js +7 -16
  20. package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +59 -75
  21. package/dist/cjs/version-wrapper.js +1 -1
  22. package/dist/es2019/labs/next/presets/universal.js +14 -2
  23. package/dist/es2019/plugins/annotation/index.js +14 -1
  24. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +2 -1
  25. package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +6 -0
  26. package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +2 -1
  27. package/dist/es2019/plugins/annotation/toolbar.js +1 -156
  28. package/dist/es2019/plugins/index.js +0 -1
  29. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
  30. package/dist/es2019/plugins/layout/actions.js +4 -3
  31. package/dist/es2019/plugins/layout/index.js +63 -57
  32. package/dist/es2019/plugins/panel/index.js +1 -1
  33. package/dist/es2019/plugins/panel/toolbar.js +9 -7
  34. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -4
  35. package/dist/es2019/plugins/rank.js +1 -1
  36. package/dist/es2019/plugins/tasks-and-decisions/index.js +1 -1
  37. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +22 -14
  38. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
  39. package/dist/es2019/plugins/undo-redo/index.js +6 -17
  40. package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +60 -61
  41. package/dist/es2019/version-wrapper.js +1 -1
  42. package/dist/esm/labs/next/presets/universal.js +14 -2
  43. package/dist/esm/plugins/annotation/index.js +12 -1
  44. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +2 -1
  45. package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
  46. package/dist/esm/plugins/annotation/pm-plugins/reducer.js +2 -1
  47. package/dist/esm/plugins/annotation/toolbar.js +1 -156
  48. package/dist/esm/plugins/index.js +0 -1
  49. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
  50. package/dist/esm/plugins/layout/actions.js +15 -12
  51. package/dist/esm/plugins/layout/index.js +7 -3
  52. package/dist/esm/plugins/panel/index.js +1 -1
  53. package/dist/esm/plugins/panel/toolbar.js +9 -7
  54. package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -6
  55. package/dist/esm/plugins/rank.js +1 -1
  56. package/dist/esm/plugins/tasks-and-decisions/index.js +1 -1
  57. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
  58. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
  59. package/dist/esm/plugins/undo-redo/index.js +6 -16
  60. package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +56 -74
  61. package/dist/esm/version-wrapper.js +1 -1
  62. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +1 -0
  63. package/dist/types/plugins/index.d.ts +0 -1
  64. package/dist/types/plugins/insert-block/types.d.ts +3 -1
  65. package/dist/types/plugins/layout/actions.d.ts +2 -1
  66. package/dist/types/plugins/layout/index.d.ts +4 -0
  67. package/dist/types/plugins/panel/index.d.ts +2 -2
  68. package/dist/types/plugins/panel/toolbar.d.ts +5 -3
  69. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +0 -1
  70. package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
  71. package/dist/types/plugins/tasks-and-decisions/types.d.ts +5 -1
  72. package/dist/types/plugins/undo-redo/types.d.ts +2 -1
  73. package/dist/types/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
  74. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +1 -0
  75. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  76. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
  77. package/dist/types-ts4.5/plugins/layout/actions.d.ts +2 -1
  78. package/dist/types-ts4.5/plugins/layout/index.d.ts +4 -0
  79. package/dist/types-ts4.5/plugins/panel/index.d.ts +2 -2
  80. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +5 -3
  81. package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +0 -1
  82. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
  83. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -1
  84. package/dist/types-ts4.5/plugins/undo-redo/types.d.ts +3 -1
  85. package/dist/types-ts4.5/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
  86. package/package.json +8 -3
  87. package/dist/cjs/plugins/history/actions.js +0 -10
  88. package/dist/cjs/plugins/history/index.js +0 -75
  89. package/dist/cjs/plugins/history/pm-history-types.js +0 -5
  90. package/dist/cjs/plugins/history/reducer.js +0 -18
  91. package/dist/cjs/plugins/history/types.js +0 -5
  92. package/dist/cjs/plugins/history/utils.js +0 -19
  93. package/dist/es2019/plugins/history/actions.js +0 -4
  94. package/dist/es2019/plugins/history/index.js +0 -61
  95. package/dist/es2019/plugins/history/pm-history-types.js +0 -1
  96. package/dist/es2019/plugins/history/reducer.js +0 -12
  97. package/dist/es2019/plugins/history/types.js +0 -1
  98. package/dist/es2019/plugins/history/utils.js +0 -11
  99. package/dist/esm/plugins/history/actions.js +0 -4
  100. package/dist/esm/plugins/history/index.js +0 -68
  101. package/dist/esm/plugins/history/pm-history-types.js +0 -1
  102. package/dist/esm/plugins/history/reducer.js +0 -12
  103. package/dist/esm/plugins/history/types.js +0 -1
  104. package/dist/esm/plugins/history/utils.js +0 -13
  105. package/dist/types/plugins/history/actions.d.ts +0 -8
  106. package/dist/types/plugins/history/index.d.ts +0 -13
  107. package/dist/types/plugins/history/pm-history-types.d.ts +0 -17
  108. package/dist/types/plugins/history/reducer.d.ts +0 -4
  109. package/dist/types/plugins/history/types.d.ts +0 -4
  110. package/dist/types/plugins/history/utils.d.ts +0 -4
  111. package/dist/types-ts4.5/plugins/history/actions.d.ts +0 -8
  112. package/dist/types-ts4.5/plugins/history/index.d.ts +0 -13
  113. package/dist/types-ts4.5/plugins/history/pm-history-types.d.ts +0 -17
  114. package/dist/types-ts4.5/plugins/history/reducer.d.ts +0 -4
  115. package/dist/types-ts4.5/plugins/history/types.d.ts +0 -4
  116. package/dist/types-ts4.5/plugins/history/utils.d.ts +0 -4
@@ -19,7 +19,7 @@ var _default = exports.default = {
19
19
  'mediaKeymap',
20
20
  // selection keymap needs to be above gap cursor keymap so it can set node selections from
21
21
  // left/right arrows
22
- 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
22
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
23
23
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
24
24
  marks: [
25
25
  // Fragment mark is both for inline and block elements
@@ -79,7 +79,7 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
79
79
  name: 'tasksAndDecisionsKeyMap',
80
80
  plugin: function plugin(_ref5) {
81
81
  var schema = _ref5.schema;
82
- return (0, _keymaps.default)(schema, allowNestedTasks, consumeTabs);
82
+ return (0, _keymaps.default)(schema, api, allowNestedTasks, consumeTabs);
83
83
  }
84
84
  } // Needs to be after "save-on-enter"
85
85
  ];
@@ -15,7 +15,8 @@ var _steps = require("@atlaskit/adf-schema/steps");
15
15
  var _utils = require("@atlaskit/editor-prosemirror/utils");
16
16
  var _adfSchema = require("@atlaskit/adf-schema");
17
17
  var _utils2 = require("@atlaskit/editor-common/utils");
18
- var _analytics = require("../../analytics");
18
+ var _analytics = require("@atlaskit/editor-common/analytics");
19
+ var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
19
20
  var _commands2 = require("../commands");
20
21
  var _commands3 = require("./commands");
21
22
  var _helpers = require("./helpers");
@@ -96,16 +97,18 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
96
97
  }
97
98
  return false;
98
99
  };
99
- var getUnindentCommand = exports.getUnindentCommand = function getUnindentCommand() {
100
- var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
101
- return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
102
- var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
103
- var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
104
- if (!curIndentLevel || curIndentLevel === 1) {
105
- return false;
106
- }
107
- return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _commands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
108
- });
100
+ var getUnindentCommand = exports.getUnindentCommand = function getUnindentCommand(editorAnalyticsAPI) {
101
+ return function () {
102
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
103
+ return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
104
+ var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
105
+ var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
106
+ if (!curIndentLevel || curIndentLevel === 1) {
107
+ return false;
108
+ }
109
+ return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _commands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
110
+ });
111
+ };
109
112
  };
110
113
 
111
114
  // if selection is decision item or first action item in table cell
@@ -122,53 +125,59 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
122
125
  }
123
126
  return false;
124
127
  };
125
- var getIndentCommand = exports.getIndentCommand = function getIndentCommand() {
126
- var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
127
- return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
128
- var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
129
- var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
130
- if (!curIndentLevel || curIndentLevel >= 6) {
131
- return true;
132
- }
133
- return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _commands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
134
- });
128
+ var getIndentCommand = exports.getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
129
+ return function () {
130
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
131
+ return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
132
+ var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
133
+ var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
134
+ if (!curIndentLevel || curIndentLevel >= 6) {
135
+ return true;
136
+ }
137
+ return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _commands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
138
+ });
139
+ };
135
140
  };
136
- var backspaceFrom = function backspaceFrom($from) {
137
- return function (state, dispatch) {
138
- // previous was empty, just delete backwards
139
- var taskBefore = $from.doc.resolve($from.before());
140
- if (taskBefore.nodeBefore && (0, _helpers.isActionOrDecisionItem)(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
141
- return false;
142
- }
141
+ var backspaceFrom = function backspaceFrom(editorAnalyticsAPI) {
142
+ return function ($from) {
143
+ return function (state, dispatch) {
144
+ // previous was empty, just delete backwards
145
+ var taskBefore = $from.doc.resolve($from.before());
146
+ if (taskBefore.nodeBefore && (0, _helpers.isActionOrDecisionItem)(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
147
+ return false;
148
+ }
143
149
 
144
- // if nested, just unindent
145
- var _state$schema$nodes3 = state.schema.nodes,
146
- taskList = _state$schema$nodes3.taskList,
147
- paragraph = _state$schema$nodes3.paragraph;
148
- if ($from.node($from.depth - 2).type === taskList) {
149
- return getUnindentCommand()(state, dispatch);
150
- }
150
+ // if nested, just unindent
151
+ var _state$schema$nodes3 = state.schema.nodes,
152
+ taskList = _state$schema$nodes3.taskList,
153
+ paragraph = _state$schema$nodes3.paragraph;
154
+ if ($from.node($from.depth - 2).type === taskList) {
155
+ return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
156
+ }
151
157
 
152
- // bottom level, should "unwrap" taskItem contents into paragraph
153
- // we achieve this by slicing the content out, and replacing
154
- if (actionDecisionFollowsOrNothing($from)) {
155
- if (dispatch) {
156
- var taskContent = state.doc.slice($from.start(), $from.end()).content;
158
+ // bottom level, should "unwrap" taskItem contents into paragraph
159
+ // we achieve this by slicing the content out, and replacing
160
+ if (actionDecisionFollowsOrNothing($from)) {
161
+ if (dispatch) {
162
+ var taskContent = state.doc.slice($from.start(), $from.end()).content;
157
163
 
158
- // might be end of document after
159
- var slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
160
- dispatch(splitListItemWith(state.tr, slice, $from, true));
164
+ // might be end of document after
165
+ var slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
166
+ dispatch(splitListItemWith(state.tr, slice, $from, true));
167
+ }
168
+ return true;
161
169
  }
162
- return true;
163
- }
164
- return false;
170
+ return false;
171
+ };
165
172
  };
166
173
  };
167
- var backspace = (0, _utils2.filterCommand)(_utils2.isEmptySelectionAtStart, (0, _commands.autoJoin)((0, _commands.chainCommands)(function (state, dispatch) {
168
- return (0, _commands3.joinAtCut)(state.selection.$from)(state, dispatch);
169
- }, (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
170
- return backspaceFrom(state.selection.$from)(state, dispatch);
171
- })), ['taskList', 'decisionList']));
174
+ var backspace = function backspace(editorAnalyticsAPI) {
175
+ return (0, _utils2.filterCommand)(_utils2.isEmptySelectionAtStart, (0, _commands.autoJoin)((0, _commands.chainCommands)(function (state, dispatch) {
176
+ return (0, _commands3.joinAtCut)(state.selection.$from)(state, dispatch);
177
+ }, (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
178
+ return backspaceFrom(editorAnalyticsAPI)(state.selection.$from)(state, dispatch);
179
+ })), ['taskList', 'decisionList']));
180
+ };
172
181
  var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTaskDecisionFollowing(state, dispatch) {
173
182
  var $from = state.selection.$from,
174
183
  _state$schema$nodes4 = state.schema.nodes,
@@ -278,42 +287,44 @@ var splitListItem = function splitListItem(state, dispatch) {
278
287
  }
279
288
  return false;
280
289
  };
281
- var enter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, (0, _commands.chainCommands)((0, _utils2.filterCommand)(_helpers.isEmptyTaskDecision, (0, _commands.chainCommands)(getUnindentCommand(), splitListItem)), function (state, dispatch) {
282
- var selection = state.selection,
283
- schema = state.schema;
284
- var taskItem = schema.nodes.taskItem;
285
- var $from = selection.$from,
286
- $to = selection.$to;
287
- var node = $from.node($from.depth);
288
- var nodeType = node && node.type;
289
- var listType = nodeType === taskItem ? 'taskList' : 'decisionList';
290
- var addItem = function addItem(_ref) {
291
- var tr = _ref.tr,
292
- itemLocalId = _ref.itemLocalId;
293
- // ED-8932: When cursor is at the beginning of a task item, instead of split, we insert above.
294
- if ($from.pos === $to.pos && $from.parentOffset === 0) {
295
- var newTask = nodeType.createAndFill({
296
- localId: itemLocalId
297
- });
298
- if (newTask) {
299
- // Current position will point to text node, but we want to insert above the taskItem node
300
- return tr.insert($from.pos - 1, newTask);
290
+ var enter = function enter(editorAnalyticsAPI) {
291
+ return (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, (0, _commands.chainCommands)((0, _utils2.filterCommand)(_helpers.isEmptyTaskDecision, (0, _commands.chainCommands)(getUnindentCommand(editorAnalyticsAPI)(), splitListItem)), function (state, dispatch) {
292
+ var selection = state.selection,
293
+ schema = state.schema;
294
+ var taskItem = schema.nodes.taskItem;
295
+ var $from = selection.$from,
296
+ $to = selection.$to;
297
+ var node = $from.node($from.depth);
298
+ var nodeType = node && node.type;
299
+ var listType = nodeType === taskItem ? 'taskList' : 'decisionList';
300
+ var addItem = function addItem(_ref) {
301
+ var tr = _ref.tr,
302
+ itemLocalId = _ref.itemLocalId;
303
+ // ED-8932: When cursor is at the beginning of a task item, instead of split, we insert above.
304
+ if ($from.pos === $to.pos && $from.parentOffset === 0) {
305
+ var newTask = nodeType.createAndFill({
306
+ localId: itemLocalId
307
+ });
308
+ if (newTask) {
309
+ // Current position will point to text node, but we want to insert above the taskItem node
310
+ return tr.insert($from.pos - 1, newTask);
311
+ }
301
312
  }
313
+ return tr.split($from.pos, 1, [{
314
+ type: nodeType,
315
+ attrs: {
316
+ localId: itemLocalId
317
+ }
318
+ }]);
319
+ };
320
+ var insertTr = (0, _commands2.insertTaskDecisionWithAnalytics)(state, listType, _analytics.INPUT_METHOD.KEYBOARD, addItem);
321
+ if (insertTr && dispatch) {
322
+ insertTr.scrollIntoView();
323
+ dispatch(insertTr);
302
324
  }
303
- return tr.split($from.pos, 1, [{
304
- type: nodeType,
305
- attrs: {
306
- localId: itemLocalId
307
- }
308
- }]);
309
- };
310
- var insertTr = (0, _commands2.insertTaskDecisionWithAnalytics)(state, listType, _analytics.INPUT_METHOD.KEYBOARD, addItem);
311
- if (insertTr && dispatch) {
312
- insertTr.scrollIntoView();
313
- dispatch(insertTr);
314
- }
315
- return true;
316
- }));
325
+ return true;
326
+ }));
327
+ };
317
328
  var cmdOptEnter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
318
329
  var selection = state.selection,
319
330
  schema = state.schema;
@@ -334,17 +345,20 @@ var cmdOptEnter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem
334
345
  }
335
346
  return true;
336
347
  });
337
- function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
348
+ function keymapPlugin(schema, api, allowNestedTasks, consumeTabs) {
349
+ var _api$analytics3, _api$analytics4;
338
350
  var indentHandlers = {
339
351
  'Shift-Tab': (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
340
352
  return !shouldLetTabThroughInTable(state);
341
353
  }], function (state, dispatch) {
342
- return getUnindentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
354
+ var _api$analytics;
355
+ return getUnindentCommand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
343
356
  }),
344
357
  Tab: (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
345
358
  return !shouldLetTabThroughInTable(state);
346
359
  }], function (state, dispatch) {
347
- return getIndentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
360
+ var _api$analytics2;
361
+ return getIndentCommand(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
348
362
  })
349
363
  };
350
364
  var defaultHandlers = consumeTabs ? {
@@ -352,10 +366,10 @@ function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
352
366
  Tab: _helpers.isInsideTaskOrDecisionItem
353
367
  } : {};
354
368
  var keymaps = _objectSpread((0, _defineProperty2.default)({
355
- Backspace: backspace,
369
+ Backspace: backspace(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
356
370
  Delete: deleteForwards,
357
371
  'Ctrl-d': deleteForwards,
358
- Enter: enter
372
+ Enter: enter(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)
359
373
  }, _keymaps.toggleTaskItemCheckbox.common, cmdOptEnter), allowNestedTasks ? indentHandlers : defaultHandlers);
360
374
  return (0, _keymap.keymap)(keymaps);
361
375
  }
@@ -30,7 +30,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
30
30
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
31
31
  }
32
32
  if (node === 'taskList') {
33
- (0, _keymaps.getIndentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
33
+ var _pluginInjectionApi$a;
34
+ (0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
34
35
  }
35
36
  break;
36
37
  }
@@ -45,7 +46,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
45
46
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
46
47
  }
47
48
  if (_node === 'taskList') {
48
- (0, _keymaps.getUnindentCommand)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
49
+ var _pluginInjectionApi$a2;
50
+ (0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
49
51
  }
50
52
  break;
51
53
  }
@@ -8,9 +8,9 @@ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _keymaps = require("./pm-plugins/keymaps");
10
10
  var _main = require("./pm-plugins/main");
11
- var _history = require("../history");
12
11
  var _ToolbarUndoRedo = _interopRequireDefault(require("./ui/ToolbarUndoRedo"));
13
- var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
12
+ // eslint-disable-next-line @atlassian/tangerine/import/entry-points
13
+
14
14
  var undoRedoPlugin = function undoRedoPlugin(_ref) {
15
15
  var api = _ref.api;
16
16
  return {
@@ -32,20 +32,11 @@ var undoRedoPlugin = function undoRedoPlugin(_ref) {
32
32
  var editorView = _ref2.editorView,
33
33
  disabled = _ref2.disabled,
34
34
  isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
35
- return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
36
- plugins: {
37
- historyState: _history.historyPluginKey
38
- },
39
- render: function render(_ref3) {
40
- var historyState = _ref3.historyState;
41
- return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
42
- isReducedSpacing: isToolbarReducedSpacing,
43
- disabled: disabled,
44
- historyState: historyState,
45
- editorView: editorView,
46
- api: api
47
- });
48
- }
35
+ return /*#__PURE__*/_react.default.createElement(_ToolbarUndoRedo.default, {
36
+ isReducedSpacing: isToolbarReducedSpacing,
37
+ disabled: disabled,
38
+ editorView: editorView,
39
+ api: api
49
40
  });
50
41
  }
51
42
  };
@@ -6,16 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = exports.ToolbarUndoRedo = void 0;
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _react = require("react");
15
- var _react2 = require("@emotion/react");
9
+ var _react = require("@emotion/react");
16
10
  var _reactIntlNext = require("react-intl-next");
17
11
  var _undo = _interopRequireDefault(require("@atlaskit/icon/glyph/undo"));
18
12
  var _redo = _interopRequireDefault(require("@atlaskit/icon/glyph/redo"));
13
+ var _hooks = require("@atlaskit/editor-common/hooks");
19
14
  var _keymaps = require("../../../../keymaps");
20
15
  var _styles = require("@atlaskit/editor-common/styles");
21
16
  var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
@@ -24,8 +19,8 @@ var _commands = require("../../commands");
24
19
  var _keymaps2 = require("@atlaskit/editor-common/keymaps");
25
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
28
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
22
+ /** @jsx jsx */
23
+
29
24
  var closeTypeAheadAndRunCommand = function closeTypeAheadAndRunCommand(editorView, api) {
30
25
  return function (command) {
31
26
  var _api$typeAhead;
@@ -51,70 +46,59 @@ var forceFocus = function forceFocus(editorView, api) {
51
46
  }
52
47
  };
53
48
  };
54
- var ToolbarUndoRedo = exports.ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
55
- (0, _inherits2.default)(ToolbarUndoRedo, _PureComponent);
56
- var _super = _createSuper(ToolbarUndoRedo);
57
- function ToolbarUndoRedo() {
58
- (0, _classCallCheck2.default)(this, ToolbarUndoRedo);
59
- return _super.apply(this, arguments);
60
- }
61
- (0, _createClass2.default)(ToolbarUndoRedo, [{
62
- key: "render",
63
- value: function render() {
64
- var _this$props = this.props,
65
- disabled = _this$props.disabled,
66
- isReducedSpacing = _this$props.isReducedSpacing,
67
- historyState = _this$props.historyState,
68
- editorView = _this$props.editorView,
69
- api = _this$props.api,
70
- formatMessage = _this$props.intl.formatMessage;
71
- var handleUndo = function handleUndo() {
72
- forceFocus(editorView, api)(_commands.undoFromToolbar);
73
- };
74
- var handleRedo = function handleRedo() {
75
- forceFocus(editorView, api)(_commands.redoFromToolbar);
76
- };
77
- var labelUndo = formatMessage(_messages.undoRedoMessages.undo);
78
- var labelRedo = formatMessage(_messages.undoRedoMessages.redo);
79
- var canUndo = historyState.canUndo,
80
- canRedo = historyState.canRedo;
81
- return (0, _react2.jsx)("span", {
82
- css: _styles.buttonGroupStyle
83
- }, (0, _react2.jsx)(_ToolbarButton.default, {
84
- buttonId: _ToolbarButton.TOOLBAR_BUTTON.UNDO,
85
- spacing: isReducedSpacing ? 'none' : 'default',
86
- onClick: handleUndo,
87
- disabled: !canUndo || disabled,
88
- "aria-label": (0, _keymaps.tooltip)(_keymaps.undo, labelUndo),
89
- "aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.undo),
90
- title: (0, _react2.jsx)(_keymaps.ToolTipContent, {
91
- description: labelUndo,
92
- keymap: _keymaps.undo
93
- }),
94
- iconBefore: (0, _react2.jsx)(_undo.default, {
95
- label: ""
96
- }),
97
- testId: "ak-editor-toolbar-button-undo"
98
- }), (0, _react2.jsx)(_ToolbarButton.default, {
99
- spacing: isReducedSpacing ? 'none' : 'default',
100
- buttonId: _ToolbarButton.TOOLBAR_BUTTON.REDO,
101
- onClick: handleRedo,
102
- disabled: !canRedo || disabled,
103
- title: (0, _react2.jsx)(_keymaps.ToolTipContent, {
104
- description: labelRedo,
105
- keymap: _keymaps.redo
106
- }),
107
- iconBefore: (0, _react2.jsx)(_redo.default, {
108
- label: ""
109
- }),
110
- testId: "ak-editor-toolbar-button-redo",
111
- "aria-label": (0, _keymaps.tooltip)(_keymaps.redo, labelRedo),
112
- "aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.redo)
113
- }), (0, _react2.jsx)("span", {
114
- css: _styles.separatorStyles
115
- }));
116
- }
117
- }]);
118
- return ToolbarUndoRedo;
119
- }(_react.PureComponent);
49
+ var ToolbarUndoRedo = exports.ToolbarUndoRedo = function ToolbarUndoRedo(_ref) {
50
+ var disabled = _ref.disabled,
51
+ isReducedSpacing = _ref.isReducedSpacing,
52
+ editorView = _ref.editorView,
53
+ api = _ref.api,
54
+ formatMessage = _ref.intl.formatMessage;
55
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['history']),
56
+ historyState = _useSharedPluginState.historyState;
57
+ var handleUndo = function handleUndo() {
58
+ forceFocus(editorView, api)(_commands.undoFromToolbar);
59
+ };
60
+ var handleRedo = function handleRedo() {
61
+ forceFocus(editorView, api)(_commands.redoFromToolbar);
62
+ };
63
+ var labelUndo = formatMessage(_messages.undoRedoMessages.undo);
64
+ var labelRedo = formatMessage(_messages.undoRedoMessages.redo);
65
+ var _ref2 = historyState !== null && historyState !== void 0 ? historyState : {},
66
+ canUndo = _ref2.canUndo,
67
+ canRedo = _ref2.canRedo;
68
+ return (0, _react.jsx)("span", {
69
+ css: _styles.buttonGroupStyle
70
+ }, (0, _react.jsx)(_ToolbarButton.default, {
71
+ buttonId: _ToolbarButton.TOOLBAR_BUTTON.UNDO,
72
+ spacing: isReducedSpacing ? 'none' : 'default',
73
+ onClick: handleUndo,
74
+ disabled: !canUndo || disabled,
75
+ "aria-label": (0, _keymaps.tooltip)(_keymaps.undo, labelUndo),
76
+ "aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.undo),
77
+ title: (0, _react.jsx)(_keymaps.ToolTipContent, {
78
+ description: labelUndo,
79
+ keymap: _keymaps.undo
80
+ }),
81
+ iconBefore: (0, _react.jsx)(_undo.default, {
82
+ label: ""
83
+ }),
84
+ testId: "ak-editor-toolbar-button-undo"
85
+ }), (0, _react.jsx)(_ToolbarButton.default, {
86
+ spacing: isReducedSpacing ? 'none' : 'default',
87
+ buttonId: _ToolbarButton.TOOLBAR_BUTTON.REDO,
88
+ onClick: handleRedo,
89
+ disabled: !canRedo || disabled,
90
+ title: (0, _react.jsx)(_keymaps.ToolTipContent, {
91
+ description: labelRedo,
92
+ keymap: _keymaps.redo
93
+ }),
94
+ iconBefore: (0, _react.jsx)(_redo.default, {
95
+ label: ""
96
+ }),
97
+ testId: "ak-editor-toolbar-button-redo",
98
+ "aria-label": (0, _keymaps.tooltip)(_keymaps.redo, labelRedo),
99
+ "aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(_keymaps.redo)
100
+ }), (0, _react.jsx)("span", {
101
+ css: _styles.separatorStyles
102
+ }));
103
+ };
120
104
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(ToolbarUndoRedo);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "188.11.4";
8
+ var version = exports.version = "188.12.1";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -1,4 +1,5 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, textColorPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../../../plugins';
2
+ import { historyPlugin } from '@atlaskit/editor-plugin-history';
2
3
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
3
4
  import { datePlugin } from '@atlaskit/editor-plugin-date';
4
5
  import { captionPlugin } from '@atlaskit/editor-plugin-caption';
@@ -19,6 +20,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
19
20
  import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
20
21
  import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
21
22
  import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
23
+ import { selectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
22
24
  import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
23
25
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
24
26
  import { createDefaultPreset } from './default';
@@ -397,6 +399,16 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
397
399
  return builder;
398
400
  }).add([codeBidiWarningPlugin, {
399
401
  appearance
400
- }]);
402
+ }])
403
+ /**
404
+ * Do not use this plugin - it is for AI purposes only.
405
+ */.maybeAdd(selectionToolbarPlugin, (plugin, builder) => {
406
+ if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
407
+ return builder.add([plugin, {
408
+ preferenceToolbarAboveSelection: false
409
+ }]);
410
+ }
411
+ return builder;
412
+ });
401
413
  return finalPreset;
402
414
  }
@@ -7,6 +7,7 @@ import { getPluginState } from './utils';
7
7
  import { buildToolbar } from './toolbar';
8
8
  import { InlineCommentView } from './ui/InlineCommentView';
9
9
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
11
  const annotationPlugin = ({
11
12
  config: annotationProviders,
12
13
  api
@@ -53,7 +54,19 @@ const annotationPlugin = ({
53
54
  }],
54
55
  pluginsOptions: {
55
56
  floatingToolbar(state, intl) {
56
- if (!annotationProviders) {
57
+ if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
58
+ return;
59
+ }
60
+ const pluginState = getPluginState(state);
61
+ if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
62
+ const {
63
+ isToolbarAbove
64
+ } = annotationProviders.inlineComment;
65
+ return buildToolbar(state, intl, isToolbarAbove);
66
+ }
67
+ },
68
+ selectionToolbar(state, intl) {
69
+ if (!getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
57
70
  return;
58
71
  }
59
72
  const pluginState = getPluginState(state);
@@ -36,7 +36,8 @@ const initialState = (disallowOnWhitespace = false) => {
36
36
  isSelecting: false
37
37
  },
38
38
  disallowOnWhitespace,
39
- isVisible: true
39
+ isVisible: true,
40
+ skipSelectionHandling: false
40
41
  };
41
42
  };
42
43
  const hideToolbar = (state, dispatch) => () => {
@@ -11,6 +11,12 @@ const handleDocChanged = (tr, prevPluginState) => {
11
11
  };
12
12
  };
13
13
  const handleSelectionChanged = (tr, pluginState) => {
14
+ if (pluginState.skipSelectionHandling) {
15
+ return {
16
+ ...pluginState,
17
+ skipSelectionHandling: false
18
+ };
19
+ }
14
20
  const selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
15
21
  const changed = selectedAnnotations.length !== pluginState.selectedAnnotations.length || selectedAnnotations.some(annotationInfo => {
16
22
  return !pluginState.selectedAnnotations.some(aInfo => aInfo.type === annotationInfo.id);
@@ -54,7 +54,8 @@ export default ((pluginState, action) => {
54
54
  case ACTIONS.SET_SELECTED_ANNOTATION:
55
55
  return {
56
56
  ...pluginState,
57
- selectedAnnotations: [...action.data.selectedAnnotations]
57
+ selectedAnnotations: [...action.data.selectedAnnotations],
58
+ skipSelectionHandling: true
58
59
  };
59
60
  default:
60
61
  return pluginState;