@atlaskit/editor-core 177.0.1 → 178.0.0

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 (79) hide show
  1. package/CHANGELOG.md +83 -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/plugins/block-type/commands/delete-and-move-cursor.js +67 -0
  9. package/dist/cjs/plugins/block-type/commands/index.js +9 -1
  10. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +8 -3
  11. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  12. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +39 -11
  13. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +8 -15
  14. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  15. package/dist/cjs/plugins/text-color/commands/change-color.js +1 -2
  16. package/dist/cjs/plugins/text-color/pm-plugins/main.js +1 -1
  17. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -10
  18. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  19. package/dist/cjs/ui/ColorPalette/Palettes/textColorPalette.js +0 -6
  20. package/dist/cjs/ui/ColorPickerButton/index.js +3 -8
  21. package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  22. package/dist/cjs/utils/performance/instrumented-plugin.js +6 -3
  23. package/dist/cjs/utils/performance/safer-transactions.js +8 -2
  24. package/dist/cjs/version-wrapper.js +1 -1
  25. package/dist/cjs/version.json +1 -1
  26. package/dist/es2019/create-editor/ErrorBoundary.js +3 -1
  27. package/dist/es2019/create-editor/ReactEditorView.js +3 -2
  28. package/dist/es2019/create-editor/create-editor.js +3 -1
  29. package/dist/es2019/editor.js +7 -0
  30. package/dist/es2019/plugins/block-type/commands/delete-and-move-cursor.js +63 -0
  31. package/dist/es2019/plugins/block-type/commands/index.js +2 -1
  32. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +7 -4
  33. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  34. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +42 -11
  35. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +9 -17
  36. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  37. package/dist/es2019/plugins/text-color/commands/change-color.js +1 -2
  38. package/dist/es2019/plugins/text-color/pm-plugins/main.js +2 -2
  39. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -6
  40. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  41. package/dist/es2019/ui/ColorPalette/Palettes/textColorPalette.js +1 -1
  42. package/dist/es2019/ui/ColorPickerButton/index.js +20 -9
  43. package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  44. package/dist/es2019/utils/performance/instrumented-plugin.js +5 -3
  45. package/dist/es2019/utils/performance/safer-transactions.js +8 -2
  46. package/dist/es2019/version-wrapper.js +1 -1
  47. package/dist/es2019/version.json +1 -1
  48. package/dist/esm/create-editor/ErrorBoundary.js +3 -1
  49. package/dist/esm/create-editor/ReactEditorView.js +3 -2
  50. package/dist/esm/create-editor/create-editor.js +3 -1
  51. package/dist/esm/editor.js +7 -0
  52. package/dist/esm/plugins/block-type/commands/delete-and-move-cursor.js +58 -0
  53. package/dist/esm/plugins/block-type/commands/index.js +2 -1
  54. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +7 -4
  55. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +12 -12
  56. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +40 -12
  57. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +9 -17
  58. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -0
  59. package/dist/esm/plugins/text-color/commands/change-color.js +1 -2
  60. package/dist/esm/plugins/text-color/pm-plugins/main.js +2 -2
  61. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -9
  62. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +19 -1
  63. package/dist/esm/ui/ColorPalette/Palettes/textColorPalette.js +1 -1
  64. package/dist/esm/ui/ColorPickerButton/index.js +5 -10
  65. package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +27 -2
  66. package/dist/esm/utils/performance/instrumented-plugin.js +6 -3
  67. package/dist/esm/utils/performance/safer-transactions.js +8 -2
  68. package/dist/esm/version-wrapper.js +1 -1
  69. package/dist/esm/version.json +1 -1
  70. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +12 -0
  71. package/dist/types/plugins/block-type/commands/index.d.ts +1 -0
  72. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  73. package/dist/types/plugins/text-color/pm-plugins/main.d.ts +1 -1
  74. package/dist/types/ui/ColorPalette/Palettes/textColorPalette.d.ts +1 -1
  75. package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +2 -1
  76. package/dist/types/utils/performance/instrumented-plugin.d.ts +1 -0
  77. package/dist/types/utils/performance/safer-transactions.d.ts +2 -1
  78. package/package.json +9 -10
  79. package/report.api.md +18 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 178.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`04e3aacbcc0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04e3aacbcc0) - ED-16069 Unskip type over mediagroup integ test
8
+
9
+ ### Minor Changes
10
+
11
+ - [`055a333dad9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/055a333dad9) - [ux] Remove `moreTextColors` feature flag and deprecate `allowMoreTextColors` field of `allowTextColor` editor prop and `colorPaletteExtended` mark.
12
+
13
+ Showing more colors in the color selection palette is now a default behaviour.
14
+
15
+ ## **DEPRECATION WARNING:**
16
+
17
+ There are 2 deprecations in this change:
18
+
19
+ ### 1. `allowMoreTextColors` field of `allowTextColor` editor prop.
20
+
21
+ `allowMoreTextColors` field of `allowTextColor` editor prop. **is now deprecated and will be removed in the next stable release of `@atlaskit/editor-core` package**. Please take steps to remove that field from your code. E.g.:
22
+
23
+ ```tsx
24
+ <Editor
25
+ ...
26
+ allowTextColor ={
27
+ allowMoreTextColors: true // <-- Deprecated
28
+ defaultColour: {color: 'red', label: 'red'}
29
+ }
30
+ />
31
+ ```
32
+
33
+ Remove all instances of `allowMoreTextColors` field from `allowTextColor` `Editor` prop. I.e.:
34
+
35
+ ```tsx
36
+ <Editor
37
+ ...
38
+ allowTextColor ={
39
+ defaultColour: {color: 'red', label: 'red'}
40
+ }
41
+ />
42
+ ```
43
+
44
+ If the resulting `allowTextColor` prop is an empty object, set `allowTextColor` property value to `true`. E.g.:
45
+
46
+ ```tsx
47
+ <Editor
48
+ appearance="full-page"
49
+ ...
50
+ allowTextColor ={
51
+ allowMoreTextColors: true // <-- Invalid
52
+ }
53
+ />
54
+ ```
55
+
56
+ should become
57
+
58
+ ```tsx
59
+ <Editor
60
+ appearance="full-page"
61
+ ...
62
+ allowTextColor={true}
63
+ />
64
+ ```
65
+
66
+ ### 2. `colorPaletteExtended` mark of the ADF schema
67
+
68
+ `colorPaletteExtended` mark of the ADF schema **is now deprecated and will be removed in the next stable release**. The extended palette is now rolled into the main one. use `colorPalette` instead.
69
+
70
+ ### Patch Changes
71
+
72
+ - [`a7eb7a6bb47`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7eb7a6bb47) - ED-16068 unskipped tests
73
+ - [`f7cdc36d75b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f7cdc36d75b) - ED016195 update EDITOR_CRASHED_ADDITIONAL_INFORMATION event name
74
+ - [`20117f2de5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/20117f2de5a) - [ux] ED-16204 Fix table cell options floating toolbar context menu closes after clicking on disabled options
75
+ - [`3f3720a4964`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3f3720a4964) - EDM-5368 make type="button" to the buttons in HyperLinkToolbar. This has caused an issue in Jira Portal where clicking the button would submit the creation form.
76
+ - [`efa8b7ee68e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/efa8b7ee68e) - ED-15808 Changes to replace usage of enzyme with React test library
77
+ - [`df20a33d886`](https://bitbucket.org/atlassian/atlassian-frontend/commits/df20a33d886) - ED-16445: Set allowUndoRedoButtons prop codemod in editor-core to run against the correct editor version (v175)
78
+ - [`e1637ca6a5c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e1637ca6a5c) - ED-16004 unskipped test
79
+ - [`31c37c54ee2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31c37c54ee2) - ED-15548 To add keyboard shortcut Alt + F9 to reach main toolbar and on 'Esc' user comes back to editor
80
+ - [`70d0799eee0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/70d0799eee0) - ED-14002 Added `safer-dispatched-transactions` featureFlag to preventtransactions from being mutated after dispatch at runtime.
81
+ - [`c6c0cab10e0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c6c0cab10e0) - [ux] ED-16205 - Fix missing yellow highlight on merged table cells when hover sort column options on table floating toolbar
82
+ - [`b9141027f87`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b9141027f87) - [ux] ED-13873 fixes a bug where after deleting a list in a panel or table the cursor would move to the cell to the right. Uses setSelection to position the cursor as expected after delete.
83
+ - [`e9a8cb724c1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9a8cb724c1) - [ux] ED-16207 - Update color picker button size and background to allow hover effect to standout
84
+ - Updated dependencies
85
+
3
86
  ## 177.0.1
4
87
 
5
88
  ### Patch Changes
@@ -0,0 +1,147 @@
1
+ jest.autoMockOff();
2
+
3
+ import { createTransformer } from '../utils';
4
+ import { removeAllowMoreColorsProp } from '../migrates/next-remove-allow-more-text-colors-prop';
5
+
6
+ // This stays as require() since changing to import will trigger a linter error
7
+ const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
8
+
9
+ const transformer = createTransformer('@atlaskit/editor-core', [
10
+ removeAllowMoreColorsProp,
11
+ ]);
12
+
13
+ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.', () => {
14
+ defineInlineTest(
15
+ { default: transformer, parser: 'tsx' },
16
+ {},
17
+ `
18
+ import React from 'react';
19
+ import { Editor } from '@atlaskit/editor-core';
20
+
21
+ export default () => <Editor
22
+ allowTextColor = {
23
+ {
24
+ allowMoreTextColors: true,
25
+ defaultColour: {color: 'red', label: 'red'}
26
+ }
27
+ }
28
+ allowStatus={true}
29
+ />
30
+ `, // -----
31
+ `
32
+ import React from 'react';
33
+ import { Editor } from '@atlaskit/editor-core';
34
+
35
+ export default () => <Editor
36
+ allowTextColor = {
37
+ {
38
+ defaultColour: {color: 'red', label: 'red'}
39
+ }
40
+ }
41
+ allowStatus={true}
42
+ />
43
+ `, // -----
44
+ 'remove allowMoreTextColors field if it exists',
45
+ );
46
+
47
+ defineInlineTest(
48
+ { default: transformer, parser: 'tsx' },
49
+ {},
50
+ `
51
+ import React from 'react';
52
+ import { Editor } from '@atlaskit/editor-core';
53
+
54
+ export default () => <Editor
55
+ appearance="full-page"
56
+ allowTextColor = {
57
+ {
58
+ allowMoreTextColors: true,
59
+ }
60
+ }
61
+ />
62
+ `, // -----
63
+ `
64
+ import React from 'react';
65
+ import { Editor } from '@atlaskit/editor-core';
66
+
67
+ export default () => <Editor
68
+ appearance="full-page"
69
+ allowTextColor={true}
70
+ />
71
+ `, // -----
72
+ 'set allowTextColor prop value to `true` if allowMoreTextColors is its only field',
73
+ );
74
+
75
+ defineInlineTest(
76
+ { default: transformer, parser: 'tsx' },
77
+ {},
78
+ `
79
+ import React from 'react';
80
+ import { Editor as MyEditor } from '@atlaskit/editor-core';
81
+
82
+ export default () => <Editor
83
+ appearance="full-page"
84
+ allowTextColor = {
85
+ {
86
+ allowMoreTextColors: true,
87
+ defaultColour: {color: 'red', label: 'red'}
88
+ }
89
+ }
90
+ />
91
+ `, // -----
92
+ `
93
+ import React from 'react';
94
+ import { Editor as MyEditor } from '@atlaskit/editor-core';
95
+
96
+ export default () => <Editor
97
+ appearance="full-page"
98
+ allowTextColor = {
99
+ {
100
+ defaultColour: {color: 'red', label: 'red'}
101
+ }
102
+ }
103
+ />
104
+ `, // -----
105
+ 'remove allowMoreTextColors prop prop when Editor is renamed',
106
+ );
107
+
108
+ defineInlineTest(
109
+ { default: transformer, parser: 'tsx' },
110
+ {},
111
+ `
112
+ import React from 'react';
113
+
114
+ const Editor = (props) => {
115
+ <div>{props.children}</div>
116
+ };
117
+
118
+ export default () => <Editor
119
+ appearance="full-page"
120
+ allowTextColor = {
121
+ {
122
+ allowMoreTextColors: true,
123
+ defaultColour: {color: 'red', label: 'red'}
124
+ }
125
+ }
126
+ />
127
+ `, // -----
128
+ `
129
+ import React from 'react';
130
+
131
+ const Editor = (props) => {
132
+ <div>{props.children}</div>
133
+ };
134
+
135
+ export default () => <Editor
136
+ appearance="full-page"
137
+ allowTextColor = {
138
+ {
139
+ allowMoreTextColors: true,
140
+ defaultColour: {color: 'red', label: 'red'}
141
+ }
142
+ }
143
+ />
144
+ `, // -----
145
+ 'only remove allowMoreTextColors prop for Editor from @atlaskit/editor-core',
146
+ );
147
+ });
@@ -0,0 +1,58 @@
1
+ import core from 'jscodeshift';
2
+ import { Collection } from 'jscodeshift/src/Collection';
3
+ import { findImportFromPackage } from '../utils';
4
+
5
+ /**
6
+ * Generate a codemod to remove `allowMoreTextColors` field
7
+ * from `allowTextColor` Editor prop.
8
+ * Ref: ED-15849
9
+ */
10
+ const createRemoveAllowMoreTextColorsPropTransform = (
11
+ pkg: string,
12
+ component: string,
13
+ ) => {
14
+ return (j: core.JSCodeshift, source: Collection<any>) => {
15
+ // Find regular or renamed imports
16
+ // of <Editor/> component from '@atlaskit/editor-core' package
17
+ const importedNames: string[] = findImportFromPackage(
18
+ j,
19
+ source,
20
+ '@atlaskit/editor-core',
21
+ 'Editor',
22
+ );
23
+
24
+ // Make the change on all instances of named imports found
25
+ importedNames.forEach((importedComponentName) => {
26
+ // Find `allowTextColor` prop
27
+ const allowTextColorCollection = source.find(j.JSXAttribute, {
28
+ name: {
29
+ type: 'JSXIdentifier',
30
+ name: 'allowTextColor',
31
+ },
32
+ });
33
+ allowTextColorCollection
34
+ .find(j.ObjectProperty, { key: { name: 'allowMoreTextColors' } })
35
+ .forEach((x) => j(x).remove());
36
+
37
+ // If the remaining `allowTextColor` prop is an empty object, set `allowTextColor` to `true`.
38
+ allowTextColorCollection.forEach((allowTextColorPath) => {
39
+ j(allowTextColorPath).find(j.ObjectExpression, (objectExpression) => {
40
+ if (objectExpression.properties.length === 0) {
41
+ j(allowTextColorPath).replaceWith(
42
+ j.jsxAttribute(
43
+ j.jsxIdentifier('allowTextColor'),
44
+ j.jsxExpressionContainer(j.booleanLiteral(true)),
45
+ ),
46
+ );
47
+ }
48
+ });
49
+ });
50
+ });
51
+ };
52
+ };
53
+
54
+ export const removeAllowMoreColorsProp =
55
+ createRemoveAllowMoreTextColorsPropTransform(
56
+ '@atlaskit/editor-core',
57
+ 'Editor',
58
+ );
@@ -119,8 +119,10 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
119
119
  actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
120
120
  eventType: _analytics.EVENT_TYPE.OPERATIONAL,
121
121
  attributes: {
122
- errorStack: errorStack,
123
122
  errorId: sharedId
123
+ },
124
+ nonPrivacySafeAttributes: {
125
+ errorStack: errorStack
124
126
  }
125
127
  });
126
128
 
@@ -391,9 +391,10 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
391
391
 
392
392
  var nodes = (0, _nodes.findChangedNodesFromTransaction)(unsafeTransaction);
393
393
  var changedNodesValid = (0, _nodes.validateNodes)(nodes);
394
- var transaction = _this.featureFlags.saferDispatchedTransactions ? new Proxy(unsafeTransaction, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
394
+ var transaction = _this.featureFlags.saferDispatchedTransactions || _this.featureFlags.saferDispatchedTransactionsAnalyticsOnly ? new Proxy(unsafeTransaction, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
395
395
  dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
396
- pluginKey: 'unknown-reacteditorview'
396
+ pluginKey: 'unknown-reacteditorview',
397
+ analyticsOnly: _this.featureFlags.saferDispatchedTransactionsAnalyticsOnly
397
398
  })) : unsafeTransaction;
398
399
 
399
400
  if (changedNodesValid) {
@@ -127,7 +127,8 @@ function createPMPlugins(config) {
127
127
  _performanceTracking$2 = performanceTracking.transactionTracking,
128
128
  transactionTracking = _performanceTracking$2 === void 0 ? TRACKING_DEFAULT : _performanceTracking$2;
129
129
  var saferDispatchedTransactions = featureFlags.saferDispatchedTransactions;
130
- var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || saferDispatchedTransactions;
130
+ var saferDispatchedTransactionsAnalyticsOnly = featureFlags.saferDispatchedTransactionsAnalyticsOnly;
131
+ var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || saferDispatchedTransactions || saferDispatchedTransactionsAnalyticsOnly;
131
132
 
132
133
  if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
133
134
  // eslint-disable-next-line no-console
@@ -139,6 +140,7 @@ function createPMPlugins(config) {
139
140
  uiTracking: uiTracking,
140
141
  transactionTracking: transactionTracking,
141
142
  saferDispatchedTransactions: saferDispatchedTransactions,
143
+ saferDispatchedTransactionsAnalyticsOnly: saferDispatchedTransactionsAnalyticsOnly,
142
144
  dispatchAnalyticsEvent: dispatchAnalyticsEvent
143
145
  }, transactionTracker);
144
146
  } : function (plugin) {
@@ -439,6 +439,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
439
439
  }, {
440
440
  key: "deprecationWarnings",
441
441
  value: function deprecationWarnings(props) {
442
+ var _props$allowTextColor;
443
+
442
444
  if (process.env.NODE_ENV === 'production') {
443
445
  return;
444
446
  }
@@ -471,6 +473,11 @@ var Editor = /*#__PURE__*/function (_React$Component) {
471
473
  // eslint-disable-next-line no-console
472
474
  console.warn("Advanced table options are deprecated (except isHeaderRowRequired) to continue using advanced table features use - <Editor allowTables={{ advanced: true }} /> [Will be changed in editor-core@".concat(nextVersion, "]"));
473
475
  }
476
+
477
+ if (props.hasOwnProperty('allowTextColor') && typeof props.allowTextColor !== 'boolean' && (props === null || props === void 0 ? void 0 : (_props$allowTextColor = props.allowTextColor) === null || _props$allowTextColor === void 0 ? void 0 : _props$allowTextColor.allowMoreTextColors) !== undefined) {
478
+ // eslint-disable-next-line no-console
479
+ console.warn("\"allowMoreTextColors\" field of \"allowTextColor\" property is deprecated. It will be removedin editor-core@".concat(nextVersion, ". The color palette now shows more colors by default."));
480
+ }
474
481
  }
475
482
  }, {
476
483
  key: "onEditorDestroyed",
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deleteAndMoveCursor = void 0;
7
+
8
+ var _prosemirrorState = require("prosemirror-state");
9
+
10
+ // We should override default behaviour when selection spans node depths or
11
+ // ends at a node junction
12
+ var shouldMoveCursorAfterDelete = function shouldMoveCursorAfterDelete(state) {
13
+ var _state$selection = state.selection,
14
+ $from = _state$selection.$from,
15
+ $to = _state$selection.$to;
16
+ var nodeRange = $from.blockRange($to);
17
+
18
+ if (!nodeRange) {
19
+ return false;
20
+ }
21
+
22
+ var hasSameAncestor = $from.depth === $to.depth && $from.depth - 1 === nodeRange.depth;
23
+ var toPositionHasNodeAfter = !!$to.nodeAfter;
24
+
25
+ if (hasSameAncestor || toPositionHasNodeAfter) {
26
+ return false;
27
+ }
28
+
29
+ return true;
30
+ };
31
+ /**
32
+ * Fixes cursor position after delete for list/task in panel and table
33
+ *
34
+ * ED-13873 fixes a bug where after deleting a list the cursor would move
35
+ * to the cell to the right. Uses setSelection to position the cursor as expected after deleting.
36
+ *
37
+ * @param state EditorState<any>
38
+ * @param dispatch CommandDispatch
39
+ * @returns boolean
40
+ */
41
+
42
+
43
+ var deleteAndMoveCursor = function deleteAndMoveCursor(state, dispatch) {
44
+ if (state.selection.empty || !(state.selection instanceof _prosemirrorState.TextSelection)) {
45
+ return false;
46
+ }
47
+
48
+ if (!shouldMoveCursorAfterDelete(state)) {
49
+ return false;
50
+ }
51
+
52
+ var tr = state.tr;
53
+ tr.deleteSelection(); // Make sure the next position is not out of boundaries
54
+
55
+ 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).
56
+ // See. selectionToInsertionEnd. We will override behavior with negative bias (search for suitable cursor position backwards).
57
+
58
+ tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(previousPosition), -1));
59
+
60
+ if (dispatch) {
61
+ dispatch(tr.scrollIntoView());
62
+ }
63
+
64
+ return true;
65
+ };
66
+
67
+ exports.deleteAndMoveCursor = deleteAndMoveCursor;
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "cleanUpAtTheStartOfDocument", {
9
9
  return _blockType.cleanUpAtTheStartOfDocument;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "deleteAndMoveCursor", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _deleteAndMoveCursor.deleteAndMoveCursor;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "insertBlock", {
13
19
  enumerable: true,
14
20
  get: function get() {
@@ -80,4 +86,6 @@ var _blockType = require("./block-type");
80
86
 
81
87
  var _insertBlock = require("./insert-block");
82
88
 
83
- var _transformToCodeBlock = require("./transform-to-code-block");
89
+ var _transformToCodeBlock = require("./transform-to-code-block");
90
+
91
+ var _deleteAndMoveCursor = require("./delete-and-move-cursor");
@@ -9,6 +9,8 @@ exports.default = keymapPlugin;
9
9
 
10
10
  var _prosemirrorHistory = require("prosemirror-history");
11
11
 
12
+ var _prosemirrorCommands = require("prosemirror-commands");
13
+
12
14
  var keymaps = _interopRequireWildcard(require("../../../keymaps"));
13
15
 
14
16
  var commands = _interopRequireWildcard(require("../../../commands"));
@@ -29,6 +31,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
31
 
30
32
  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; }
31
33
 
34
+ var backspace = (0, _prosemirrorCommands.chainCommands)(_commands2.cleanUpAtTheStartOfDocument, _commands2.deleteAndMoveCursor);
35
+ var del = (0, _prosemirrorCommands.chainCommands)((0, _commands3.deleteEmptyParagraphAndMoveBlockUp)(_utils.isNodeAWrappingBlockNode), _commands2.deleteAndMoveCursor);
36
+
32
37
  function keymapPlugin(schema, featureFlags) {
33
38
  var list = {};
34
39
  keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, commands.insertNewLineWithAnalytics, list);
@@ -36,9 +41,9 @@ function keymapPlugin(schema, featureFlags) {
36
41
  keymaps.bindKeymapWithCommand(keymaps.moveDown.common, commands.createNewParagraphBelow, list);
37
42
  keymaps.bindKeymapWithCommand(keymaps.findKeyMapForBrowser(keymaps.redo), _prosemirrorHistory.redo, list);
38
43
  keymaps.bindKeymapWithCommand(keymaps.undo.common, _prosemirrorHistory.undo, list);
39
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, _commands2.cleanUpAtTheStartOfDocument, list);
40
- keymaps.bindKeymapWithCommand(keymaps.deleteKey.common, (0, _commands3.deleteEmptyParagraphAndMoveBlockUp)(_utils.isNodeAWrappingBlockNode), list);
41
- keymaps.bindKeymapWithCommand(keymaps.forwardDelete.mac, (0, _commands3.deleteEmptyParagraphAndMoveBlockUp)(_utils.isNodeAWrappingBlockNode), list);
44
+ keymaps.bindKeymapWithCommand(keymaps.backspace.common, backspace, list);
45
+ keymaps.bindKeymapWithCommand(keymaps.deleteKey.common, del, list);
46
+ keymaps.bindKeymapWithCommand(keymaps.forwardDelete.mac, del, list);
42
47
 
43
48
  if (schema.nodes[blockTypes.BLOCK_QUOTE.nodeName]) {
44
49
  keymaps.bindKeymapWithCommand(keymaps.findShortcutByKeymap(keymaps.toggleBlockQuote), (0, _commands2.insertBlockTypesWithAnalytics)(blockTypes.BLOCK_QUOTE.name, _analytics.INPUT_METHOD.KEYBOARD), list);
@@ -43,7 +43,7 @@ function getSpellCheck(featureFlags) {
43
43
 
44
44
 
45
45
  function createFeatureFlagsFromProps(props) {
46
- 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;
46
+ 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;
47
47
 
48
48
  var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
49
49
  var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
@@ -51,7 +51,6 @@ function createFeatureFlagsFromProps(props) {
51
51
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
52
52
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
53
53
  placeholderBracketHint: !!props.placeholderBracketHint,
54
- moreTextColors: typeof props.allowTextColor === 'boolean' ? false : Boolean(((_props$allowTextColor = props.allowTextColor) === null || _props$allowTextColor === void 0 ? void 0 : _props$allowTextColor.allowMoreTextColors) === true),
55
54
  findReplace: !!props.allowFindReplace,
56
55
  findReplaceMatchCase: (0, _typeof2.default)(props.allowFindReplace) === 'object' && Boolean(props.allowFindReplace.allowMatchCase),
57
56
  addColumnWithCustomStep: !props.allowTables || typeof props.allowTables === 'boolean' ? false : Boolean(props.allowTables.allowAddColumnWithCustomStep),
@@ -72,21 +71,22 @@ function createFeatureFlagsFromProps(props) {
72
71
  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),
73
72
  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),
74
73
  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)),
74
+ 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)),
75
75
  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),
76
- chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
76
+ chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
77
77
  tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
78
- 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),
79
- 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)),
80
- 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)),
81
- 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,
78
+ 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),
79
+ 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)),
80
+ 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)),
81
+ 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,
82
82
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
83
83
  // Including fallback to props.featureFlags so that mobile feature flags
84
84
  // are included (they are not kebab cased)
85
- restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.restartNumberedLists) === true,
86
- listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.listNumberContinuity) === true,
87
- restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedListsToolbar) === true,
88
- 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)),
85
+ restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedLists) === true,
86
+ listNumberContinuity: normalizedFeatureFlags.listNumberContinuity === true || ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39.listNumberContinuity) === true,
87
+ restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedListsToolbar) === true,
88
+ 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)),
89
89
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
90
- 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)
90
+ 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)
91
91
  });
92
92
  }
@@ -39,7 +39,7 @@ var _reactIntlNext = require("react-intl-next");
39
39
 
40
40
  var _messages = _interopRequireDefault(require("./messages"));
41
41
 
42
- var _templateObject, _templateObject2;
42
+ var _templateObject, _templateObject2, _templateObject3;
43
43
 
44
44
  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); }; }
45
45
 
@@ -52,6 +52,7 @@ var menuItemDimensions = {
52
52
  exports.menuItemDimensions = menuItemDimensions;
53
53
  var spacer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex: 1;\n padding: 8px;\n"])));
54
54
  var menuContainer = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\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, (0, _constants.gridSize)() * 4, (0, _constants.gridSize)() / 2);
55
+ var label = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n width: 100%;\n"])));
55
56
  var itemSpacing = (0, _constants.gridSize)() / 2;
56
57
  exports.itemSpacing = itemSpacing;
57
58
  var DropdownButtonItem = _menu.ButtonItem;
@@ -68,17 +69,24 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
68
69
  tooltipContent = _useState2[0],
69
70
  setTooltipContent = _useState2[1];
70
71
 
71
- var handleTooltipMouseOut = (0, _react.useCallback)(function () {
72
+ var handleItemMouseOut = (0, _react.useCallback)(function () {
72
73
  setTooltipContent('');
73
- }, []);
74
+
75
+ if (item.onMouseOut) {
76
+ dispatchCommand(item.onMouseOut);
77
+ }
78
+ }, [item.onMouseOut, dispatchCommand]);
74
79
  var handleItemMouseDown = (0, _react.useCallback)(function (e) {
75
- e.preventDefault();
76
- }, []);
77
- var handleItemMouseOver = (0, _react.useCallback)(function (e) {
80
+ e.preventDefault(); // ED-16204 - This is needed for safari to get handleItemClick() to work
81
+
82
+ if (item.onMouseDown) {
83
+ dispatchCommand(item.onMouseDown);
84
+ }
85
+ }, [item.onMouseDown, dispatchCommand]);
86
+ var handleItemMouseOver = (0, _react.useCallback)(function () {
78
87
  setTooltipContent(item.tooltip || '');
79
88
 
80
89
  if (item.onMouseOver) {
81
- e.preventDefault();
82
90
  dispatchCommand(item.onMouseOver);
83
91
  }
84
92
  }, [item.tooltip, item.onMouseOver, dispatchCommand]);
@@ -120,6 +128,24 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
120
128
  editorView === null || editorView === void 0 ? void 0 : editorView.focus();
121
129
  }
122
130
  }, [dispatchCommand, item.onClick, hide, editorView]);
131
+ /* ED-16704 - Native mouse event handler to overcome firefox issue on disabled <button> - https://github.com/whatwg/html/issues/5886 */
132
+
133
+ var labelRef = /*#__PURE__*/(0, _react.createRef)();
134
+ var handleTitleWrapperMouseEvent = (0, _react.useCallback)(function (e) {
135
+ if (item.disabled) {
136
+ e.stopPropagation();
137
+ e.preventDefault();
138
+ }
139
+ }, [item.disabled]);
140
+ (0, _react.useEffect)(function () {
141
+ var labelRefCurrent = labelRef.current;
142
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.addEventListener('click', handleTitleWrapperMouseEvent);
143
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.addEventListener('mousedown', handleTitleWrapperMouseEvent);
144
+ return function () {
145
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.removeEventListener('click', handleTitleWrapperMouseEvent);
146
+ labelRefCurrent === null || labelRefCurrent === void 0 ? void 0 : labelRefCurrent.removeEventListener('mousedown', handleTitleWrapperMouseEvent);
147
+ };
148
+ });
123
149
  var itemContent = (0, _react2.jsx)(DropdownButtonItem, {
124
150
  iconBefore: iconBefore,
125
151
  iconAfter: item.elemAfter,
@@ -130,16 +156,18 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
130
156
  onMouseOver: handleItemMouseOver,
131
157
  onMouseEnter: handleItemMouseEnter,
132
158
  onMouseLeave: handleItemMouseLeave,
159
+ onMouseOut: handleItemMouseOut,
133
160
  onFocus: handleItemOnFocus,
134
161
  onBlur: handleItemOnBlur
135
- }, item.title);
162
+ }, (0, _react2.jsx)("span", {
163
+ ref: labelRef,
164
+ css: label
165
+ }, item.title));
136
166
 
137
167
  if (tooltipContent) {
138
168
  return (0, _react2.jsx)(_tooltip.default, {
139
169
  content: tooltipContent
140
- }, (0, _react2.jsx)("div", {
141
- onMouseOut: handleTooltipMouseOut
142
- }, itemContent));
170
+ }, itemContent);
143
171
  }
144
172
 
145
173
  return itemContent;