@atlaskit/editor-core 177.0.1 → 178.0.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 (83) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/codemods/__tests__/next-remove-allow-more-text-colors-prop.ts +147 -0
  3. package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +58 -0
  4. package/dist/cjs/create-editor/ErrorBoundary.js +3 -1
  5. package/dist/cjs/create-editor/ReactEditorView.js +3 -2
  6. package/dist/cjs/create-editor/create-editor.js +3 -1
  7. package/dist/cjs/editor.js +7 -0
  8. package/dist/cjs/extensibility.js +7 -6
  9. package/dist/cjs/plugins/block-type/commands/delete-and-move-cursor.js +67 -0
  10. package/dist/cjs/plugins/block-type/commands/index.js +9 -1
  11. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +8 -3
  12. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  13. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +39 -11
  14. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +8 -15
  15. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  16. package/dist/cjs/plugins/text-color/commands/change-color.js +1 -2
  17. package/dist/cjs/plugins/text-color/pm-plugins/main.js +1 -1
  18. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -10
  19. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  20. package/dist/cjs/ui/ColorPalette/Palettes/textColorPalette.js +0 -6
  21. package/dist/cjs/ui/ColorPickerButton/index.js +3 -8
  22. package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  23. package/dist/cjs/utils/performance/instrumented-plugin.js +6 -3
  24. package/dist/cjs/utils/performance/safer-transactions.js +8 -2
  25. package/dist/cjs/version-wrapper.js +1 -1
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/create-editor/ErrorBoundary.js +3 -1
  28. package/dist/es2019/create-editor/ReactEditorView.js +3 -2
  29. package/dist/es2019/create-editor/create-editor.js +3 -1
  30. package/dist/es2019/editor.js +7 -0
  31. package/dist/es2019/extensibility.js +8 -1
  32. package/dist/es2019/plugins/block-type/commands/delete-and-move-cursor.js +63 -0
  33. package/dist/es2019/plugins/block-type/commands/index.js +2 -1
  34. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +7 -4
  35. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  36. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +42 -11
  37. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +9 -17
  38. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  39. package/dist/es2019/plugins/text-color/commands/change-color.js +1 -2
  40. package/dist/es2019/plugins/text-color/pm-plugins/main.js +2 -2
  41. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -6
  42. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  43. package/dist/es2019/ui/ColorPalette/Palettes/textColorPalette.js +1 -1
  44. package/dist/es2019/ui/ColorPickerButton/index.js +20 -9
  45. package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  46. package/dist/es2019/utils/performance/instrumented-plugin.js +5 -3
  47. package/dist/es2019/utils/performance/safer-transactions.js +8 -2
  48. package/dist/es2019/version-wrapper.js +1 -1
  49. package/dist/es2019/version.json +1 -1
  50. package/dist/esm/create-editor/ErrorBoundary.js +3 -1
  51. package/dist/esm/create-editor/ReactEditorView.js +3 -2
  52. package/dist/esm/create-editor/create-editor.js +3 -1
  53. package/dist/esm/editor.js +7 -0
  54. package/dist/esm/extensibility.js +8 -1
  55. package/dist/esm/plugins/block-type/commands/delete-and-move-cursor.js +58 -0
  56. package/dist/esm/plugins/block-type/commands/index.js +2 -1
  57. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +7 -4
  58. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  59. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +40 -12
  60. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +9 -17
  61. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  62. package/dist/esm/plugins/text-color/commands/change-color.js +1 -2
  63. package/dist/esm/plugins/text-color/pm-plugins/main.js +2 -2
  64. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -9
  65. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  66. package/dist/esm/ui/ColorPalette/Palettes/textColorPalette.js +1 -1
  67. package/dist/esm/ui/ColorPickerButton/index.js +5 -10
  68. package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  69. package/dist/esm/utils/performance/instrumented-plugin.js +6 -3
  70. package/dist/esm/utils/performance/safer-transactions.js +8 -2
  71. package/dist/esm/version-wrapper.js +1 -1
  72. package/dist/esm/version.json +1 -1
  73. package/dist/types/extensibility.d.ts +6 -1
  74. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +12 -0
  75. package/dist/types/plugins/block-type/commands/index.d.ts +1 -0
  76. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  77. package/dist/types/plugins/text-color/pm-plugins/main.d.ts +1 -1
  78. package/dist/types/ui/ColorPalette/Palettes/textColorPalette.d.ts +1 -1
  79. package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +2 -1
  80. package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -0
  81. package/dist/types/utils/performance/safer-transactions.d.ts +2 -1
  82. package/package.json +11 -12
  83. package/report.api.md +18 -2
@@ -0,0 +1,58 @@
1
+ import { Selection, TextSelection } from 'prosemirror-state';
2
+
3
+ // We should override default behaviour when selection spans node depths or
4
+ // ends at a node junction
5
+ var shouldMoveCursorAfterDelete = function shouldMoveCursorAfterDelete(state) {
6
+ var _state$selection = state.selection,
7
+ $from = _state$selection.$from,
8
+ $to = _state$selection.$to;
9
+ var nodeRange = $from.blockRange($to);
10
+
11
+ if (!nodeRange) {
12
+ return false;
13
+ }
14
+
15
+ var hasSameAncestor = $from.depth === $to.depth && $from.depth - 1 === nodeRange.depth;
16
+ var toPositionHasNodeAfter = !!$to.nodeAfter;
17
+
18
+ if (hasSameAncestor || toPositionHasNodeAfter) {
19
+ return false;
20
+ }
21
+
22
+ return true;
23
+ };
24
+ /**
25
+ * Fixes cursor position after delete for list/task in panel and table
26
+ *
27
+ * ED-13873 fixes a bug where after deleting a list the cursor would move
28
+ * to the cell to the right. Uses setSelection to position the cursor as expected after deleting.
29
+ *
30
+ * @param state EditorState<any>
31
+ * @param dispatch CommandDispatch
32
+ * @returns boolean
33
+ */
34
+
35
+
36
+ export var deleteAndMoveCursor = function deleteAndMoveCursor(state, dispatch) {
37
+ if (state.selection.empty || !(state.selection instanceof TextSelection)) {
38
+ return false;
39
+ }
40
+
41
+ if (!shouldMoveCursorAfterDelete(state)) {
42
+ return false;
43
+ }
44
+
45
+ var tr = state.tr;
46
+ tr.deleteSelection(); // Make sure the next position is not out of boundaries
47
+
48
+ var previousPosition = Math.min(Math.max(state.selection.$from.pos, 0), tr.doc.content.size); // Override default delete behaviour that moves the cursor to first suitable position after selection (postive bias).
49
+ // See. selectionToInsertionEnd. We will override behavior with negative bias (search for suitable cursor position backwards).
50
+
51
+ tr.setSelection(Selection.near(tr.doc.resolve(previousPosition), -1));
52
+
53
+ if (dispatch) {
54
+ dispatch(tr.scrollIntoView());
55
+ }
56
+
57
+ return true;
58
+ };
@@ -1,3 +1,4 @@
1
1
  export { cleanUpAtTheStartOfDocument, insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics, setHeading, setHeadingWithAnalytics, setNormalText, setNormalTextWithAnalytics } from './block-type';
2
2
  export { insertBlock } from './insert-block';
3
- export { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
3
+ export { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
4
+ export { deleteAndMoveCursor } from './delete-and-move-cursor';
@@ -1,12 +1,15 @@
1
1
  import { redo, undo } from 'prosemirror-history';
2
+ import { chainCommands } from 'prosemirror-commands';
2
3
  import * as keymaps from '../../../keymaps';
3
4
  import * as commands from '../../../commands';
4
5
  import * as blockTypes from '../types';
5
6
  import { keymap } from '../../../utils/keymap';
6
- import { cleanUpAtTheStartOfDocument, insertBlockTypesWithAnalytics } from '../commands';
7
+ import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, insertBlockTypesWithAnalytics } from '../commands';
7
8
  import { deleteEmptyParagraphAndMoveBlockUp } from '../../../utils/commands';
8
9
  import { INPUT_METHOD } from '../../analytics';
9
10
  import { isNodeAWrappingBlockNode } from '../utils';
11
+ var backspace = chainCommands(cleanUpAtTheStartOfDocument, deleteAndMoveCursor);
12
+ var del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteAndMoveCursor);
10
13
  export default function keymapPlugin(schema, featureFlags) {
11
14
  var list = {};
12
15
  keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, commands.insertNewLineWithAnalytics, list);
@@ -14,9 +17,9 @@ export default function keymapPlugin(schema, featureFlags) {
14
17
  keymaps.bindKeymapWithCommand(keymaps.moveDown.common, commands.createNewParagraphBelow, list);
15
18
  keymaps.bindKeymapWithCommand(keymaps.findKeyMapForBrowser(keymaps.redo), redo, list);
16
19
  keymaps.bindKeymapWithCommand(keymaps.undo.common, undo, list);
17
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, cleanUpAtTheStartOfDocument, list);
18
- keymaps.bindKeymapWithCommand(keymaps.deleteKey.common, deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), list);
19
- keymaps.bindKeymapWithCommand(keymaps.forwardDelete.mac, deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), list);
20
+ keymaps.bindKeymapWithCommand(keymaps.backspace.common, backspace, list);
21
+ keymaps.bindKeymapWithCommand(keymaps.deleteKey.common, del, list);
22
+ keymaps.bindKeymapWithCommand(keymaps.forwardDelete.mac, del, list);
20
23
 
21
24
  if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
22
25
  keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.toggleBlockQuote), insertBlockTypesWithAnalytics(blockTypes.BLOCK_QUOTE.name, INPUT_METHOD.KEYBOARD), list);
@@ -33,7 +33,7 @@ function getSpellCheck(featureFlags) {
33
33
 
34
34
 
35
35
  export function createFeatureFlagsFromProps(props) {
36
- var _props$featureFlags, _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$collabEdit, _props$collabEdit2, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42;
36
+ var _props$featureFlags, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$collabEdit, _props$collabEdit2, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44;
37
37
 
38
38
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
39
39
  var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
@@ -41,7 +41,6 @@ export function createFeatureFlagsFromProps(props) {
41
41
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
42
42
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
43
43
  placeholderBracketHint: !!props.placeholderBracketHint,
44
- moreTextColors: typeof props.allowTextColor === 'boolean' ? false : Boolean(((_props$allowTextColor = props.allowTextColor) === null || _props$allowTextColor === void 0 ? void 0 : _props$allowTextColor.allowMoreTextColors) === true),
45
44
  findReplace: !!props.allowFindReplace,
46
45
  findReplaceMatchCase: _typeof(props.allowFindReplace) === 'object' && Boolean(props.allowFindReplace.allowMatchCase),
47
46
  addColumnWithCustomStep: !props.allowTables || typeof props.allowTables === 'boolean' ? false : Boolean(props.allowTables.allowAddColumnWithCustomStep),
@@ -62,21 +61,22 @@ export function createFeatureFlagsFromProps(props) {
62
61
  ufo: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.ufo) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.ufo) : false),
63
62
  twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.twoLineEditorToolbar) : false),
64
63
  saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.saferDispatchedTransactions) : false)),
64
+ saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.saferDispatchedTransactionsAnalyticsOnly) : false)),
65
65
  useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
66
- chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
66
+ chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
67
67
  tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
68
- showHoverPreview: Boolean(typeof ((_props$featureFlags29 = props.featureFlags) === null || _props$featureFlags29 === void 0 ? void 0 : _props$featureFlags29.showHoverPreview) === 'boolean' ? !!((_props$featureFlags30 = props.featureFlags) !== null && _props$featureFlags30 !== void 0 && _props$featureFlags30.showHoverPreview) : false),
69
- indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags32 = props.featureFlags) !== null && _props$featureFlags32 !== void 0 && _props$featureFlags32.indentationButtonsInTheToolbar) : false)),
70
- floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.floatingToolbarCopyButton) : false)),
71
- floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
68
+ showHoverPreview: Boolean(typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.showHoverPreview) === 'boolean' ? !!((_props$featureFlags32 = props.featureFlags) !== null && _props$featureFlags32 !== void 0 && _props$featureFlags32.showHoverPreview) : false),
69
+ indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.indentationButtonsInTheToolbar) : false)),
70
+ floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.floatingToolbarCopyButton) : false)),
71
+ floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
72
72
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
73
73
  // Including fallback to props.featureFlags so that mobile feature flags
74
74
  // are included (they are not kebab cased)
75
- restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.restartNumberedLists) === true,
76
- listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.listNumberContinuity) === true,
77
- restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedListsToolbar) === true,
78
- useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags40 = props.featureFlags) !== null && _props$featureFlags40 !== void 0 && _props$featureFlags40.useSomewhatSemanticTextColorNames) : false)),
75
+ restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedLists) === true,
76
+ listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39.listNumberContinuity) === true,
77
+ restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedListsToolbar) === true,
78
+ useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42.useSomewhatSemanticTextColorNames) : false)),
79
79
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
80
- preventPopupOverflow: Boolean(typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42['prevent-popup-overflow']) : false)
80
+ preventPopupOverflow: Boolean(typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44['prevent-popup-overflow']) : false)
81
81
  });
82
82
  }
@@ -6,14 +6,14 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
7
7
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
8
8
 
9
- var _templateObject, _templateObject2;
9
+ var _templateObject, _templateObject2, _templateObject3;
10
10
 
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
 
13
13
  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; } }
14
14
 
15
15
  /** @jsx jsx */
16
- import { useState, useCallback } from 'react';
16
+ import { useState, useCallback, useEffect, createRef } from 'react';
17
17
  import { css, jsx } from '@emotion/react';
18
18
  import { Component } from 'react';
19
19
  import { gridSize } from '@atlaskit/theme/constants';
@@ -29,6 +29,7 @@ export var menuItemDimensions = {
29
29
  };
30
30
  var spacer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n padding: 8px;\n"])));
31
31
  var menuContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: ", "px;\n\n // temporary solution to retain spacing defined by @atlaskit/Item\n & button {\n min-height: ", "px;\n padding: 8px 8px 7px;\n\n & > [data-item-elem-before] {\n margin-right: ", "px;\n }\n }\n"])), menuItemDimensions.width, gridSize() * 4, gridSize() / 2);
32
+ var label = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-block;\n width: 100%;\n"])));
32
33
  export var itemSpacing = gridSize() / 2;
33
34
  var DropdownButtonItem = ButtonItem;
34
35
 
@@ -44,17 +45,24 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
44
45
  tooltipContent = _useState2[0],
45
46
  setTooltipContent = _useState2[1];
46
47
 
47
- var handleTooltipMouseOut = useCallback(function () {
48
+ var handleItemMouseOut = useCallback(function () {
48
49
  setTooltipContent('');
49
- }, []);
50
+
51
+ if (item.onMouseOut) {
52
+ dispatchCommand(item.onMouseOut);
53
+ }
54
+ }, [item.onMouseOut, dispatchCommand]);
50
55
  var handleItemMouseDown = useCallback(function (e) {
51
- e.preventDefault();
52
- }, []);
53
- var handleItemMouseOver = useCallback(function (e) {
56
+ e.preventDefault(); // ED-16204 - This is needed for safari to get handleItemClick() to work
57
+
58
+ if (item.onMouseDown) {
59
+ dispatchCommand(item.onMouseDown);
60
+ }
61
+ }, [item.onMouseDown, dispatchCommand]);
62
+ var handleItemMouseOver = useCallback(function () {
54
63
  setTooltipContent(item.tooltip || '');
55
64
 
56
65
  if (item.onMouseOver) {
57
- e.preventDefault();
58
66
  dispatchCommand(item.onMouseOver);
59
67
  }
60
68
  }, [item.tooltip, item.onMouseOver, dispatchCommand]);
@@ -96,6 +104,24 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
96
104
  editorView === null || editorView === void 0 ? void 0 : editorView.focus();
97
105
  }
98
106
  }, [dispatchCommand, item.onClick, hide, editorView]);
107
+ /* ED-16704 - Native mouse event handler to overcome firefox issue on disabled <button> - https://github.com/whatwg/html/issues/5886 */
108
+
109
+ var labelRef = /*#__PURE__*/createRef();
110
+ var handleTitleWrapperMouseEvent = useCallback(function (e) {
111
+ if (item.disabled) {
112
+ e.stopPropagation();
113
+ e.preventDefault();
114
+ }
115
+ }, [item.disabled]);
116
+ useEffect(function () {
117
+ var labelRefCurrent = labelRef.current;
118
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.addEventListener('click', handleTitleWrapperMouseEvent);
119
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.addEventListener('mousedown', handleTitleWrapperMouseEvent);
120
+ return function () {
121
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.removeEventListener('click', handleTitleWrapperMouseEvent);
122
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.removeEventListener('mousedown', handleTitleWrapperMouseEvent);
123
+ };
124
+ });
99
125
  var itemContent = jsx(DropdownButtonItem, {
100
126
  iconBefore: iconBefore,
101
127
  iconAfter: item.elemAfter,
@@ -106,16 +132,18 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
106
132
  onMouseOver: handleItemMouseOver,
107
133
  onMouseEnter: handleItemMouseEnter,
108
134
  onMouseLeave: handleItemMouseLeave,
135
+ onMouseOut: handleItemMouseOut,
109
136
  onFocus: handleItemOnFocus,
110
137
  onBlur: handleItemOnBlur
111
- }, item.title);
138
+ }, jsx("span", {
139
+ ref: labelRef,
140
+ css: label
141
+ }, item.title));
112
142
 
113
143
  if (tooltipContent) {
114
144
  return jsx(Tooltip, {
115
145
  content: tooltipContent
116
- }, jsx("div", {
117
- onMouseOut: handleTooltipMouseOut
118
- }, itemContent));
146
+ }, itemContent);
119
147
  }
120
148
 
121
149
  return itemContent;
@@ -23,7 +23,7 @@ import { themed } from '@atlaskit/theme/components';
23
23
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
24
24
  import { DN70 } from '@atlaskit/theme/colors';
25
25
  import { getFeatureFlags } from '../../feature-flags-context';
26
- import { compareArrays, getFirstFocusableElement, shallowEqual } from '../utils';
26
+ import { compareArrays, shallowEqual } from '../utils';
27
27
  import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
28
28
  import Button from './Button';
29
29
  import Dropdown from './Dropdown';
@@ -336,14 +336,6 @@ var Toolbar = /*#__PURE__*/function (_Component) {
336
336
 
337
337
  _this = _super.call(this, props);
338
338
 
339
- _defineProperty(_assertThisInitialized(_this), "focusToolbar", function (event) {
340
- if (event.altKey && event.keyCode === 121) {
341
- var _getFirstFocusableEle, _this$toolbarContaine;
342
-
343
- (_getFirstFocusableEle = getFirstFocusableElement((_this$toolbarContaine = _this.toolbarContainerRef) === null || _this$toolbarContaine === void 0 ? void 0 : _this$toolbarContaine.current)) === null || _getFirstFocusableEle === void 0 ? void 0 : _getFirstFocusableEle.focus();
344
- }
345
- });
346
-
347
339
  _defineProperty(_assertThisInitialized(_this), "shouldHandleArrowKeys", function () {
348
340
  var _this$props$items;
349
341
 
@@ -422,7 +414,6 @@ var Toolbar = /*#__PURE__*/function (_Component) {
422
414
  this.setState({
423
415
  mounted: true
424
416
  });
425
- document.addEventListener('keydown', this.focusToolbar);
426
417
  }
427
418
  }, {
428
419
  key: "componentDidUpdate",
@@ -439,13 +430,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
439
430
  this.resetStyling({
440
431
  table: this.props.node.type.name === 'table'
441
432
  });
442
- document.removeEventListener('keydown', this.focusToolbar);
443
433
  }
444
- /**
445
- * To listen to keyboard shortcut Alt+F10 and focus floating toolbar's first focusable element.
446
- * @param event
447
- */
448
-
449
434
  }, {
450
435
  key: "render",
451
436
  value: function render() {
@@ -465,11 +450,18 @@ var Toolbar = /*#__PURE__*/function (_Component) {
465
450
  var hasSelect = items.find(function (item) {
466
451
  return item.type === 'select' && item.selectType === 'list';
467
452
  });
453
+
454
+ var isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) {
455
+ //Alt + F10 to reach first element in this floating toolbar
456
+ return event.altKey && (event.key === 'F10' || event.keyCode === 121);
457
+ };
458
+
468
459
  return jsx(React.Fragment, null, jsx(ToolbarArrowKeyNavigationProvider, {
469
460
  editorView: this.props.editorView,
470
461
  handleEscape: this.handleEscape,
471
462
  disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
472
- childComponentSelector: "[data-testid='editor-floating-toolbar']"
463
+ childComponentSelector: "[data-testid='editor-floating-toolbar']",
464
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar
473
465
  }, jsx("div", {
474
466
  ref: this.toolbarContainerRef,
475
467
  css: function css(theme) {
@@ -979,6 +979,7 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
979
979
  }), displayUrl && jsx(Tooltip, {
980
980
  content: formatClearLinkText
981
981
  }, jsx("button", {
982
+ type: "button",
982
983
  css: clearText,
983
984
  onClick: this.handleClearText
984
985
  }, jsx(CrossCircleIcon, {
@@ -1006,6 +1007,7 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
1006
1007
  }), displayText && jsx(Tooltip, {
1007
1008
  content: formatMessage(messages.clearText)
1008
1009
  }, jsx("button", {
1010
+ type: "button",
1009
1011
  css: clearText,
1010
1012
  onClick: this.handleClearDisplayText,
1011
1013
  onKeyDown: this.handleClearTextKeyDown
@@ -41,8 +41,7 @@ export var changeColor = function changeColor(color) {
41
41
  if (textColor) {
42
42
  var pluginState = pluginKey.getState(state);
43
43
  var activeColor = getActiveColor(state);
44
- var withColorAnalytics = createWithColorAnalytics(color, activeColor, // palette is a subset of paletteExpanded
45
- pluginState.paletteExpanded || pluginState.palette);
44
+ var withColorAnalytics = createWithColorAnalytics(color, activeColor, pluginState.palette);
46
45
 
47
46
  if (pluginState.disabled) {
48
47
  return false;
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
 
8
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
9
9
  import { PluginKey } from 'prosemirror-state';
10
- import { textColorPaletteExtended } from '../../../ui/ColorPalette/Palettes/textColorPalette';
10
+ import { textColorPalette } from '../../../ui/ColorPalette/Palettes/textColorPalette';
11
11
  import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
12
12
  import { DEFAULT_COLOR, getActiveColor } from '../utils/color';
13
13
  import { getDisabledState } from '../utils/disabled';
@@ -18,7 +18,7 @@ export function createInitialPluginState(editorState, pluginConfig) {
18
18
  value: defaultColor.color,
19
19
  label: defaultColor.label,
20
20
  border: DEFAULT_BORDER_COLOR
21
- }].concat(_toConsumableArray(textColorPaletteExtended));
21
+ }].concat(_toConsumableArray(textColorPalette));
22
22
  var state = {
23
23
  color: getActiveColor(editorState),
24
24
  disabled: getDisabledState(editorState),
@@ -21,7 +21,6 @@ import { defineMessages, injectIntl } from 'react-intl-next';
21
21
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
22
22
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
23
23
  import ColorPalette from '../../../../ui/ColorPalette';
24
- import { textColorPalette as originalTextColors } from '../../../../ui/ColorPalette/Palettes/textColorPalette';
25
24
  import Dropdown from '../../../../ui/Dropdown';
26
25
  import { expandIconWrapperStyle, wrapperStyle, separatorStyles, triggerWrapperStyles } from '../../../../ui/styles';
27
26
  import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
@@ -77,20 +76,14 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
77
76
  if (!disabled) {
78
77
  var _this$props$editorVie;
79
78
 
80
- var _this$props$pluginSta = _this.props.pluginState,
81
- palette = _this$props$pluginSta.palette,
82
- defaultColor = _this$props$pluginSta.defaultColor; // we store color names in analytics
79
+ var palette = _this.props.pluginState.palette; // we store color names in analytics
83
80
 
84
81
  var swatch = palette.find(function (sw) {
85
82
  return sw.value === color;
86
83
  });
87
- var isNewColor = color !== defaultColor && !originalTextColors.some(function (col) {
88
- return col.value === color;
89
- });
90
84
 
91
85
  _this.dispatchAnalyticsEvent(_this.buildAnalyticsSelectColor({
92
- color: (swatch ? swatch.label : color).toLowerCase(),
93
- isNewColor: isNewColor
86
+ color: (swatch ? swatch.label : color).toLowerCase()
94
87
  }));
95
88
 
96
89
  _this.handleOpenChange({
@@ -73,13 +73,31 @@ export var EditorToolbar = /*#__PURE__*/React.memo(function (props) {
73
73
  };
74
74
  }
75
75
  });
76
+
77
+ var isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) {
78
+ //Alt + F9 to reach first element in this main toolbar
79
+ return event.altKey && (event.key === 'F9' || event.keyCode === 120);
80
+ };
81
+
82
+ var handleEscape = function handleEscape(event) {
83
+ var _props$editorView;
84
+
85
+ if (!((_props$editorView = props.editorView) !== null && _props$editorView !== void 0 && _props$editorView.hasFocus())) {
86
+ var _props$editorView2;
87
+
88
+ (_props$editorView2 = props.editorView) === null || _props$editorView2 === void 0 ? void 0 : _props$editorView2.focus();
89
+ }
90
+ };
91
+
76
92
  return jsx(ContextPanelConsumer, null, function (_ref) {
77
93
  var _props$featureFlags8, _props$featureFlags9, _props$featureFlags10;
78
94
 
79
95
  var contextPanelWidth = _ref.width;
80
96
  return jsx(ToolbarArrowKeyNavigationProvider, {
81
97
  editorView: props.editorView,
82
- childComponentSelector: "[data-testid='ak-editor-main-toolbar']"
98
+ childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
99
+ isShortcutToFocusToolbar: isShortcutToFocusToolbar,
100
+ handleEscape: handleEscape
83
101
  }, jsx("div", {
84
102
  css: mainToolbarStyle(props.showKeyline || contextPanelWidth > 0, !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.twoLineEditorToolbar)),
85
103
  "data-testid": "ak-editor-main-toolbar"
@@ -1 +1 @@
1
- export { textColorPalette, textColorPaletteExtended } from '@atlaskit/editor-common/ui-color';
1
+ export { textColorPalette } from '@atlaskit/editor-common/ui-color';
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
3
 
4
- var _templateObject, _templateObject2;
4
+ var _templateObject, _templateObject2, _templateObject3;
5
5
 
6
6
  /** @jsx jsx */
7
7
  import React from 'react';
@@ -15,8 +15,8 @@ import ColorPalette from '../ColorPalette';
15
15
  import { DEFAULT_BORDER_COLOR } from '../ColorPalette/Palettes/common';
16
16
  import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
17
17
  import { editorAnalyticsChannel } from '../../plugins/analytics/consts';
18
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics/types'; // helps adjusts position of popup
19
-
18
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics/types';
19
+ // helps adjusts position of popup
20
20
  var colorPickerButtonWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"]))); // Control the size of color picker buttons and preview
21
21
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4134
22
22
 
@@ -104,6 +104,7 @@ var ColorPickerButton = function ColorPickerButton(props) {
104
104
  };
105
105
 
106
106
  var title = props.title || '';
107
+ var buttonStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 6px;\n background-color: ", ";\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n padding: 0;\n }\n "])), "var(--ds-background-neutral, transparent)", DEFAULT_BORDER_COLOR, borderRadius(), props.currentColor || 'transparent', ((_props$size = props.size) === null || _props$size === void 0 ? void 0 : _props$size.width) || 14, ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.height) || 14);
107
108
  return jsx("div", {
108
109
  css: colorPickerButtonWrapper
109
110
  }, jsx(Tooltip, {
@@ -114,13 +115,7 @@ var ColorPickerButton = function ColorPickerButton(props) {
114
115
  "aria-label": title,
115
116
  spacing: "compact",
116
117
  onClick: togglePopup,
117
- style: {
118
- backgroundColor: props.currentColor || 'transparent',
119
- border: "1px solid ".concat(DEFAULT_BORDER_COLOR),
120
- width: "".concat(((_props$size = props.size) === null || _props$size === void 0 ? void 0 : _props$size.width) || 20, "px"),
121
- height: "".concat(((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.height) || 20, "px"),
122
- padding: 0
123
- }
118
+ css: buttonStyle
124
119
  })), renderPopup());
125
120
  };
126
121
 
@@ -23,7 +23,8 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
23
23
  editorView = _ref.editorView,
24
24
  childComponentSelector = _ref.childComponentSelector,
25
25
  handleEscape = _ref.handleEscape,
26
- disableArrowKeyNavigation = _ref.disableArrowKeyNavigation;
26
+ disableArrowKeyNavigation = _ref.disableArrowKeyNavigation,
27
+ isShortcutToFocusToolbar = _ref.isShortcutToFocusToolbar;
27
28
  var wrapperRef = useRef(null);
28
29
  var selectedItemIndex = useRef(0);
29
30
  var incrementIndex = useCallback(function (list) {
@@ -139,11 +140,35 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
139
140
  }
140
141
  };
141
142
 
143
+ var globalKeyDownHandler = function globalKeyDownHandler(event) {
144
+ //To focus the first element in the toolbar
145
+ if (isShortcutToFocusToolbar(event)) {
146
+ var _filteredFocusableEle4, _filteredFocusableEle5;
147
+
148
+ var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
149
+ (_filteredFocusableEle4 = filteredFocusableElements[0]) === null || _filteredFocusableEle4 === void 0 ? void 0 : _filteredFocusableEle4.focus();
150
+ (_filteredFocusableEle5 = filteredFocusableElements[0]) === null || _filteredFocusableEle5 === void 0 ? void 0 : _filteredFocusableEle5.scrollIntoView({
151
+ behavior: 'smooth',
152
+ block: 'center',
153
+ inline: 'nearest'
154
+ });
155
+ }
156
+ };
157
+
142
158
  element === null || element === void 0 ? void 0 : element.addEventListener('keydown', handleKeyDown);
159
+
160
+ if (isShortcutToFocusToolbar) {
161
+ document.addEventListener('keydown', globalKeyDownHandler);
162
+ }
163
+
143
164
  return function () {
144
165
  element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', handleKeyDown);
166
+
167
+ if (isShortcutToFocusToolbar) {
168
+ document.removeEventListener('keydown', globalKeyDownHandler);
169
+ }
145
170
  };
146
- }, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex]);
171
+ }, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar]);
147
172
  return /*#__PURE__*/React.createElement("div", {
148
173
  className: "custom-key-handler-wrapper",
149
174
  ref: wrapperRef
@@ -35,8 +35,10 @@ export var InstrumentedPlugin = /*#__PURE__*/function (_SafePlugin) {
35
35
  } : _options$uiTracking,
36
36
  _options$saferDispatc = options.saferDispatchedTransactions,
37
37
  saferDispatchedTransactions = _options$saferDispatc === void 0 ? false : _options$saferDispatc,
38
+ _options$saferDispatc2 = options.saferDispatchedTransactionsAnalyticsOnly,
39
+ saferDispatchedTransactionsAnalyticsOnly = _options$saferDispatc2 === void 0 ? false : _options$saferDispatc2,
38
40
  dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
39
- var shouldOverrideApply = transactionTracking.enabled && transactionTracker || saferDispatchedTransactions;
41
+ var shouldOverrideApply = transactionTracking.enabled && transactionTracker || saferDispatchedTransactions || saferDispatchedTransactionsAnalyticsOnly;
40
42
 
41
43
  if (shouldOverrideApply && spec.state) {
42
44
  var originalApply = spec.state.apply.bind(spec.state);
@@ -44,9 +46,10 @@ export var InstrumentedPlugin = /*#__PURE__*/function (_SafePlugin) {
44
46
  spec.state.apply = function (aTr, value, oldState, newState) {
45
47
  var self = _assertThisInitialized(_this);
46
48
 
47
- var tr = saferDispatchedTransactions ? new Proxy(aTr, freezeUnsafeTransactionProperties({
49
+ var tr = saferDispatchedTransactions || saferDispatchedTransactionsAnalyticsOnly ? new Proxy(aTr, freezeUnsafeTransactionProperties({
48
50
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
49
- pluginKey: self.key
51
+ pluginKey: self.key,
52
+ analyticsOnly: saferDispatchedTransactionsAnalyticsOnly
50
53
  })) : aTr;
51
54
  var shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
52
55
 
@@ -11,7 +11,8 @@ var isReadOnlyProperty = function isReadOnlyProperty(prop) {
11
11
 
12
12
  export var freezeUnsafeTransactionProperties = function freezeUnsafeTransactionProperties(_ref) {
13
13
  var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
14
- pluginKey = _ref.pluginKey;
14
+ pluginKey = _ref.pluginKey,
15
+ analyticsOnly = _ref.analyticsOnly;
15
16
 
16
17
  var isUnsafe = function isUnsafe() {
17
18
  if (dispatchAnalyticsEvent) {
@@ -21,11 +22,16 @@ export var freezeUnsafeTransactionProperties = function freezeUnsafeTransactionP
21
22
  eventType: EVENT_TYPE.OPERATIONAL,
22
23
  attributes: {
23
24
  pluginKey: pluginKey || 'unknown'
25
+ },
26
+ nonPrivacySafeAttributes: {
27
+ stack: new Error().stack
24
28
  }
25
29
  });
26
30
  }
27
31
 
28
- throw new Error(UNSAFE_PROPERTY_SET_ERROR);
32
+ if (!analyticsOnly) {
33
+ throw new Error(UNSAFE_PROPERTY_SET_ERROR);
34
+ }
29
35
  };
30
36
 
31
37
  return {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "177.0.1";
2
+ export var version = "178.0.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "177.0.1",
3
+ "version": "178.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,12 @@ export { toJSON } from './utils';
4
4
  export { default as Extension } from './plugins/extension/ui/Extension';
5
5
  export { default as ExtensionNodeWrapper } from './plugins/extension/ui/Extension/ExtensionNodeWrapper';
6
6
  export { ExtensionNode } from './plugins/extension/nodeviews/extension';
7
- export { pluginKey as tablePluginKey } from '@atlaskit/editor-plugin-table/plugin-key';
7
+ /**
8
+ * @deprecated [ED-14688] - used during the table viz project and not used anymore
9
+ * will be removed in a future version of `@atlaskit/editor-core`
10
+ */
11
+ declare const tablePluginKey: import("prosemirror-state").PluginKey<import("@atlaskit/editor-plugin-table/types").TablePluginState, any>;
12
+ export { tablePluginKey };
8
13
  export declare const EmitterEvents: {
9
14
  TABLE_DELETED: string;
10
15
  };