@atlaskit/editor-core 184.0.4 → 185.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 (189) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
  3. package/dist/cjs/editor-next/index.js +41 -34
  4. package/dist/cjs/editor.js +30 -269
  5. package/dist/cjs/i18n/en_ZZ.js +32 -6
  6. package/dist/cjs/index.js +0 -7
  7. package/dist/cjs/labs/next/presets/default.js +2 -1
  8. package/dist/cjs/plugins/base/index.js +0 -12
  9. package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
  10. package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
  11. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
  12. package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
  13. package/dist/cjs/plugins/card/toolbar.js +11 -9
  14. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
  15. package/dist/cjs/plugins/code-block/index.js +7 -5
  16. package/dist/cjs/plugins/code-block/toolbar.js +5 -5
  17. package/dist/cjs/plugins/copy-button/commands.js +2 -3
  18. package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
  19. package/dist/cjs/plugins/expand/index.js +1 -1
  20. package/dist/cjs/plugins/expand/toolbar.js +40 -39
  21. package/dist/cjs/plugins/extension/index.js +1 -1
  22. package/dist/cjs/plugins/extension/toolbar.js +5 -5
  23. package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
  24. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  25. package/dist/cjs/plugins/layout/index.js +8 -4
  26. package/dist/cjs/plugins/layout/toolbar.js +5 -6
  27. package/dist/cjs/plugins/media/toolbar/index.js +31 -24
  28. package/dist/cjs/plugins/panel/index.js +2 -1
  29. package/dist/cjs/plugins/panel/toolbar.js +7 -7
  30. package/dist/cjs/plugins/placeholder-text/index.js +7 -5
  31. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  32. package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
  33. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  34. package/dist/cjs/version-wrapper.js +1 -1
  35. package/dist/cjs/version.json +1 -1
  36. package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
  37. package/dist/es2019/editor-next/index.js +39 -30
  38. package/dist/es2019/editor.js +29 -232
  39. package/dist/es2019/i18n/en_ZZ.js +32 -6
  40. package/dist/es2019/index.js +1 -2
  41. package/dist/es2019/labs/next/presets/default.js +2 -1
  42. package/dist/es2019/plugins/base/index.js +0 -7
  43. package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
  44. package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
  45. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
  46. package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
  47. package/dist/es2019/plugins/card/toolbar.js +8 -6
  48. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  49. package/dist/es2019/plugins/code-block/index.js +7 -5
  50. package/dist/es2019/plugins/code-block/toolbar.js +5 -6
  51. package/dist/es2019/plugins/copy-button/commands.js +2 -3
  52. package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
  53. package/dist/es2019/plugins/expand/index.js +1 -1
  54. package/dist/es2019/plugins/expand/toolbar.js +5 -6
  55. package/dist/es2019/plugins/extension/index.js +1 -1
  56. package/dist/es2019/plugins/extension/toolbar.js +5 -6
  57. package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
  58. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  59. package/dist/es2019/plugins/layout/index.js +8 -5
  60. package/dist/es2019/plugins/layout/toolbar.js +5 -6
  61. package/dist/es2019/plugins/media/toolbar/index.js +35 -24
  62. package/dist/es2019/plugins/panel/index.js +2 -2
  63. package/dist/es2019/plugins/panel/toolbar.js +7 -8
  64. package/dist/es2019/plugins/placeholder-text/index.js +7 -5
  65. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
  66. package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
  67. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  68. package/dist/es2019/version-wrapper.js +1 -1
  69. package/dist/es2019/version.json +1 -1
  70. package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
  71. package/dist/esm/editor-next/index.js +42 -33
  72. package/dist/esm/editor.js +29 -270
  73. package/dist/esm/i18n/en_ZZ.js +32 -6
  74. package/dist/esm/index.js +1 -2
  75. package/dist/esm/labs/next/presets/default.js +2 -1
  76. package/dist/esm/plugins/base/index.js +0 -9
  77. package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
  78. package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
  79. package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
  80. package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
  81. package/dist/esm/plugins/card/toolbar.js +7 -6
  82. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  83. package/dist/esm/plugins/code-block/index.js +7 -5
  84. package/dist/esm/plugins/code-block/toolbar.js +5 -5
  85. package/dist/esm/plugins/copy-button/commands.js +2 -3
  86. package/dist/esm/plugins/copy-button/toolbar.js +7 -8
  87. package/dist/esm/plugins/expand/index.js +1 -1
  88. package/dist/esm/plugins/expand/toolbar.js +40 -39
  89. package/dist/esm/plugins/extension/index.js +1 -1
  90. package/dist/esm/plugins/extension/toolbar.js +5 -5
  91. package/dist/esm/plugins/floating-toolbar/index.js +3 -2
  92. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  93. package/dist/esm/plugins/layout/index.js +8 -4
  94. package/dist/esm/plugins/layout/toolbar.js +5 -6
  95. package/dist/esm/plugins/media/toolbar/index.js +31 -24
  96. package/dist/esm/plugins/panel/index.js +2 -1
  97. package/dist/esm/plugins/panel/toolbar.js +7 -7
  98. package/dist/esm/plugins/placeholder-text/index.js +7 -5
  99. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  100. package/dist/esm/ui/CollapsedEditor/index.js +1 -2
  101. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  102. package/dist/esm/version-wrapper.js +1 -1
  103. package/dist/esm/version.json +1 -1
  104. package/dist/types/editor-next/index.d.ts +0 -6
  105. package/dist/types/editor.d.ts +1 -137
  106. package/dist/types/i18n/en_ZZ.d.ts +28 -2
  107. package/dist/types/index.d.ts +0 -1
  108. package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
  109. package/dist/types/labs/next/presets/default.d.ts +212 -0
  110. package/dist/types/labs/next/presets/mobile.d.ts +106 -0
  111. package/dist/types/plugins/base/index.d.ts +0 -4
  112. package/dist/types/plugins/card/index.d.ts +2 -2
  113. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
  114. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
  115. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  116. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
  117. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
  118. package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
  119. package/dist/types/plugins/card/toolbar.d.ts +1 -2
  120. package/dist/types/plugins/card/types.d.ts +1 -1
  121. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  122. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  123. package/dist/types/plugins/card/ui/types.d.ts +1 -1
  124. package/dist/types/plugins/code-block/index.d.ts +7 -1
  125. package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
  126. package/dist/types/plugins/copy-button/commands.d.ts +2 -1
  127. package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
  128. package/dist/types/plugins/expand/index.d.ts +2 -1
  129. package/dist/types/plugins/expand/toolbar.d.ts +2 -1
  130. package/dist/types/plugins/extension/index.d.ts +7 -2
  131. package/dist/types/plugins/extension/toolbar.d.ts +2 -1
  132. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
  133. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  134. package/dist/types/plugins/layout/index.d.ts +7 -1
  135. package/dist/types/plugins/layout/toolbar.d.ts +2 -1
  136. package/dist/types/plugins/media/index.d.ts +3 -1
  137. package/dist/types/plugins/panel/index.d.ts +2 -0
  138. package/dist/types/plugins/panel/toolbar.d.ts +3 -2
  139. package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
  140. package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
  141. package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
  142. package/dist/types-ts4.5/editor.d.ts +1 -137
  143. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
  144. package/dist/types-ts4.5/index.d.ts +0 -1
  145. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
  146. package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
  147. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
  148. package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
  149. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  150. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
  151. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
  152. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  153. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
  154. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
  155. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
  156. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
  157. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
  158. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  159. package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  160. package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
  161. package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
  162. package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
  163. package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
  164. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
  165. package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
  166. package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
  167. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  168. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
  169. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  170. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  171. package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
  172. package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
  173. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  174. package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
  175. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
  176. package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
  177. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
  178. package/package.json +13 -8
  179. package/report.api.md +5 -93
  180. package/dist/cjs/editor-next/editor-migration-component.js +0 -54
  181. package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
  182. package/dist/es2019/editor-next/editor-migration-component.js +0 -30
  183. package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
  184. package/dist/esm/editor-next/editor-migration-component.js +0 -47
  185. package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
  186. package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
  187. package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
  188. package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
  189. package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
@@ -8,48 +8,49 @@ exports.getToolbarConfig = void 0;
8
8
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
9
9
  var _messages = _interopRequireDefault(require("../../messages"));
10
10
  var _commands = require("./commands");
11
- var _decoration = require("../base/pm-plugins/decoration");
12
11
  var _pluginFactory = require("./pm-plugins/plugin-factory");
13
- var getToolbarConfig = function getToolbarConfig(state, _ref) {
14
- var formatMessage = _ref.formatMessage;
15
- var _getPluginState = (0, _pluginFactory.getPluginState)(state),
16
- expandRef = _getPluginState.expandRef;
17
- if (expandRef) {
18
- var _state$schema$nodes = state.schema.nodes,
19
- nestedExpand = _state$schema$nodes.nestedExpand,
20
- expand = _state$schema$nodes.expand;
21
- return {
22
- title: 'Expand toolbar',
23
- getDomRef: function getDomRef() {
24
- return expandRef;
25
- },
26
- nodeType: [nestedExpand, expand],
27
- offset: [0, 6],
28
- items: [{
29
- type: 'copy-button',
12
+ var getToolbarConfig = function getToolbarConfig(hoverDecoration) {
13
+ return function (state, _ref) {
14
+ var formatMessage = _ref.formatMessage;
15
+ var _getPluginState = (0, _pluginFactory.getPluginState)(state),
16
+ expandRef = _getPluginState.expandRef;
17
+ if (expandRef) {
18
+ var _state$schema$nodes = state.schema.nodes,
19
+ nestedExpand = _state$schema$nodes.nestedExpand,
20
+ expand = _state$schema$nodes.expand;
21
+ return {
22
+ title: 'Expand toolbar',
23
+ getDomRef: function getDomRef() {
24
+ return expandRef;
25
+ },
26
+ nodeType: [nestedExpand, expand],
27
+ offset: [0, 6],
30
28
  items: [{
31
- state: state,
32
- formatMessage: formatMessage,
33
- nodeType: [nestedExpand, expand]
29
+ type: 'copy-button',
30
+ items: [{
31
+ state: state,
32
+ formatMessage: formatMessage,
33
+ nodeType: [nestedExpand, expand]
34
+ }, {
35
+ type: 'separator'
36
+ }]
34
37
  }, {
35
- type: 'separator'
38
+ id: 'editor.expand.delete',
39
+ type: 'button',
40
+ appearance: 'danger',
41
+ focusEditoronEnter: true,
42
+ icon: _remove.default,
43
+ onClick: (0, _commands.deleteExpand)(),
44
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
45
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
46
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
47
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
48
+ title: formatMessage(_messages.default.remove),
49
+ tabIndex: null
36
50
  }]
37
- }, {
38
- id: 'editor.expand.delete',
39
- type: 'button',
40
- appearance: 'danger',
41
- focusEditoronEnter: true,
42
- icon: _remove.default,
43
- onClick: (0, _commands.deleteExpand)(),
44
- onMouseEnter: (0, _decoration.hoverDecoration)([nestedExpand, expand], true),
45
- onMouseLeave: (0, _decoration.hoverDecoration)([nestedExpand, expand], false),
46
- onFocus: (0, _decoration.hoverDecoration)([nestedExpand, expand], true),
47
- onBlur: (0, _decoration.hoverDecoration)([nestedExpand, expand], false),
48
- title: formatMessage(_messages.default.remove),
49
- tabIndex: null
50
- }]
51
- };
52
- }
53
- return;
51
+ };
52
+ }
53
+ return;
54
+ };
54
55
  };
55
56
  exports.getToolbarConfig = getToolbarConfig;
@@ -54,7 +54,7 @@ var extensionPlugin = function extensionPlugin() {
54
54
  }];
55
55
  },
56
56
  pluginsOptions: {
57
- floatingToolbar: (0, _toolbar.getToolbarConfig)(options.breakoutEnabled),
57
+ floatingToolbar: (0, _toolbar.getToolbarConfig)(options.breakoutEnabled, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
58
58
  contextPanel: (0, _contextPanel.getContextPanel)(options.allowAutoSave, featureFlags)
59
59
  }
60
60
  };
@@ -14,7 +14,6 @@ var _mediaFullWidth = _interopRequireDefault(require("@atlaskit/icon/glyph/edito
14
14
  var _mediaWide = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wide"));
15
15
  var _mediaCenter = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-center"));
16
16
  var _messages = _interopRequireDefault(require("../../messages"));
17
- var _decoration = require("../base/pm-plugins/decoration");
18
17
  var _actions = require("./actions");
19
18
  var _main = require("./pm-plugins/main");
20
19
  var _utils = require("./utils");
@@ -122,6 +121,7 @@ var editButton = function editButton(formatMessage, extensionState) {
122
121
  };
123
122
  var getToolbarConfig = function getToolbarConfig() {
124
123
  var breakoutEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
124
+ var hoverDecoration = arguments.length > 1 ? arguments[1] : undefined;
125
125
  return function (state, intl) {
126
126
  var formatMessage = intl.formatMessage;
127
127
  var extensionState = (0, _main.getPluginState)(state);
@@ -181,10 +181,10 @@ var getToolbarConfig = function getToolbarConfig() {
181
181
  icon: _remove.default,
182
182
  appearance: 'danger',
183
183
  onClick: (0, _commands.removeExtension)(),
184
- onMouseEnter: (0, _decoration.hoverDecoration)(nodeType, true),
185
- onMouseLeave: (0, _decoration.hoverDecoration)(nodeType, false),
186
- onFocus: (0, _decoration.hoverDecoration)(nodeType, true),
187
- onBlur: (0, _decoration.hoverDecoration)(nodeType, false),
184
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
185
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
186
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
187
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
188
188
  focusEditoronEnter: true,
189
189
  title: formatMessage(_messages.default.remove),
190
190
  tabIndex: null,
@@ -201,7 +201,7 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
201
201
  return null;
202
202
  }
203
203
  var customPositionCalculation;
204
- var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node));
204
+ var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node), api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
205
205
  if (onPositionCalculated) {
206
206
  customPositionCalculation = function customPositionCalculation(nextPos) {
207
207
  return onPositionCalculated(editorView, nextPos);
@@ -259,7 +259,8 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
259
259
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
260
260
  extensionsProvider: extensionsState === null || extensionsState === void 0 ? void 0 : extensionsState.extensionProvider,
261
261
  scrollable: scrollable,
262
- featureFlags: featureFlags
262
+ featureFlags: featureFlags,
263
+ api: api
263
264
  })), /*#__PURE__*/_react.default.createElement(_ConfirmationModal.ConfirmationModal, {
264
265
  testId: "ak-floating-toolbar-confirmation-modal",
265
266
  options: confirmDialogOptions,
@@ -36,7 +36,6 @@ var _EmojiPickerButton = require("./EmojiPickerButton");
36
36
  var _announcer = _interopRequireDefault(require("../../../utils/announcer/announcer"));
37
37
  var _reactIntlNext = require("react-intl-next");
38
38
  var _messages = _interopRequireDefault(require("./messages"));
39
- var _decoration = require("../../base/pm-plugins/decoration");
40
39
  var _commands2 = require("@atlaskit/editor-plugin-table/commands");
41
40
  var _ScrollButtons = _interopRequireDefault(require("./ScrollButtons"));
42
41
  var _ToolbarArrowKeyNavigationProvider = require("../../../ui/ToolbarArrowKeyNavigationProvider");
@@ -378,15 +377,14 @@ var Toolbar = /*#__PURE__*/function (_Component) {
378
377
  value: function resetStyling(_ref4) {
379
378
  var table = _ref4.table;
380
379
  if (this.props.editorView) {
380
+ var _this$props$api;
381
381
  var _this$props$editorVie2 = this.props.editorView,
382
382
  state = _this$props$editorVie2.state,
383
383
  dispatch = _this$props$editorVie2.dispatch;
384
384
  if (table) {
385
385
  return (0, _commands2.clearHoverSelection)()(state, dispatch);
386
386
  }
387
- dispatch(state.tr.setMeta(_decoration.decorationStateKey, {
388
- action: _decoration.ACTIONS.DECORATION_REMOVE
389
- }));
387
+ (_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.dependencies.decorations.actions.removeDecoration(state, dispatch);
390
388
  }
391
389
  }
392
390
  }, {
@@ -17,11 +17,12 @@ var _main = _interopRequireDefault(require("./pm-plugins/main"));
17
17
  var _toolbar = require("./toolbar");
18
18
  var _actions = require("./actions");
19
19
  var _assets = require("../quick-insert/assets");
20
- var _analytics = require("../analytics");
20
+ var _analytics = require("@atlaskit/editor-common/analytics");
21
21
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
22
22
  var _pluginKey = require("./pm-plugins/plugin-key");
23
23
  var layoutPlugin = function layoutPlugin() {
24
24
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
+ var api = arguments.length > 1 ? arguments[1] : undefined;
25
26
  return {
26
27
  name: 'layout',
27
28
  nodes: function nodes() {
@@ -49,7 +50,8 @@ var layoutPlugin = function layoutPlugin() {
49
50
  addSidebarLayouts = _ref.addSidebarLayouts,
50
51
  allowSingleColumnLayout = _ref.allowSingleColumnLayout;
51
52
  if (pos !== null) {
52
- return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout);
53
+ var _api$dependencies$dec;
54
+ return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$dependencies$dec = api.dependencies.decorations.actions) === null || _api$dependencies$dec === void 0 ? void 0 : _api$dependencies$dec.hoverDecoration);
53
55
  }
54
56
  return undefined;
55
57
  },
@@ -65,8 +67,9 @@ var layoutPlugin = function layoutPlugin() {
65
67
  return /*#__PURE__*/_react.default.createElement(_assets.IconLayout, null);
66
68
  },
67
69
  action: function action(insert, state) {
70
+ var _api$dependencies$ana, _api$dependencies$ana2;
68
71
  var tr = insert((0, _actions.createDefaultLayoutSection)(state));
69
- return (0, _analytics.addAnalytics)(state, tr, {
72
+ api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : (_api$dependencies$ana2 = _api$dependencies$ana.actions) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.attachAnalyticsEvent({
70
73
  action: _analytics.ACTION.INSERTED,
71
74
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
72
75
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.LAYOUT,
@@ -74,7 +77,8 @@ var layoutPlugin = function layoutPlugin() {
74
77
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
75
78
  },
76
79
  eventType: _analytics.EVENT_TYPE.TRACK
77
- });
80
+ })(tr);
81
+ return tr;
78
82
  }
79
83
  }];
80
84
  }
@@ -17,7 +17,6 @@ var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove
17
17
  var _toolbarMessages = require("./toolbar-messages");
18
18
  var _messages = _interopRequireDefault(require("../../messages"));
19
19
  var _actions = require("./actions");
20
- var _decoration = require("../base/pm-plugins/decoration");
21
20
  var LAYOUT_TYPES = [{
22
21
  id: 'editor.layout.twoEquals',
23
22
  type: 'two_equal',
@@ -65,7 +64,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
65
64
  };
66
65
  var layoutToolbarTitle = 'Layout floating controls';
67
66
  exports.layoutToolbarTitle = layoutToolbarTitle;
68
- var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
67
+ var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, hoverDecoration) {
69
68
  var node = state.doc.nodeAt(pos);
70
69
  if (node) {
71
70
  var currentLayout = (0, _actions.getPresetLayout)(node);
@@ -82,10 +81,10 @@ var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSi
82
81
  testId: _messages.default.remove.id,
83
82
  title: intl.formatMessage(_messages.default.remove),
84
83
  onClick: _actions.deleteActiveLayoutNode,
85
- onMouseEnter: (0, _decoration.hoverDecoration)(nodeType, true),
86
- onMouseLeave: (0, _decoration.hoverDecoration)(nodeType, false),
87
- onFocus: (0, _decoration.hoverDecoration)(nodeType, true),
88
- onBlur: (0, _decoration.hoverDecoration)(nodeType, false),
84
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
85
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
86
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
87
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
89
88
  tabIndex: null
90
89
  };
91
90
  var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
@@ -15,7 +15,6 @@ var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"))
15
15
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
16
16
  var _messages = _interopRequireDefault(require("../../../messages"));
17
17
  var _pluginKey = require("../pm-plugins/plugin-key");
18
- var _decoration = require("../../base/pm-plugins/decoration");
19
18
  var _linking = require("./linking");
20
19
  var _MediaAndEmbedsToolbar = _interopRequireDefault(require("../../../ui/MediaAndEmbedsToolbar"));
21
20
  var _linking2 = require("../pm-plugins/linking");
@@ -23,7 +22,7 @@ var _altText = require("../pm-plugins/alt-text");
23
22
  var _altText2 = require("./alt-text");
24
23
  var _linking3 = require("../commands/linking");
25
24
  var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
26
- var _analytics = require("../../analytics");
25
+ var _analytics = require("@atlaskit/editor-common/analytics");
27
26
  var _mediaUi = require("@atlaskit/media-ui");
28
27
  var _messages2 = require("../../card/messages");
29
28
  var _filePreviewItem = require("./filePreviewItem");
@@ -48,7 +47,7 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
48
47
  }
49
48
  return true;
50
49
  };
51
- var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState) {
50
+ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
52
51
  var mediaGroup = state.schema.nodes.mediaGroup;
53
52
  var items = [{
54
53
  id: 'editor.media.view.switcher',
@@ -111,17 +110,17 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
111
110
  appearance: 'danger',
112
111
  focusEditoronEnter: true,
113
112
  icon: _remove.default,
114
- onMouseEnter: (0, _decoration.hoverDecoration)(mediaGroup, true),
115
- onMouseLeave: (0, _decoration.hoverDecoration)(mediaGroup, false),
116
- onFocus: (0, _decoration.hoverDecoration)(mediaGroup, true),
117
- onBlur: (0, _decoration.hoverDecoration)(mediaGroup, false),
113
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
114
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
115
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
116
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
118
117
  title: intl.formatMessage(_messages.default.remove),
119
118
  onClick: handleRemoveMediaGroup,
120
119
  testId: 'media-toolbar-remove-button'
121
120
  }];
122
121
  return items;
123
122
  };
124
- var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState) {
123
+ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
125
124
  var mediaInline = state.schema.nodes.mediaInline;
126
125
  var items = [{
127
126
  id: 'editor.media.view.switcher',
@@ -184,17 +183,18 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
184
183
  appearance: 'danger',
185
184
  focusEditoronEnter: true,
186
185
  icon: _remove.default,
187
- onMouseEnter: (0, _decoration.hoverDecoration)(mediaInline, true),
188
- onMouseLeave: (0, _decoration.hoverDecoration)(mediaInline, false),
189
- onFocus: (0, _decoration.hoverDecoration)(mediaInline, true),
190
- onBlur: (0, _decoration.hoverDecoration)(mediaInline, false),
186
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
187
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
188
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
189
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
191
190
  title: intl.formatMessage(_messages.default.remove),
192
191
  onClick: _commands.removeInlineCard,
193
192
  testId: 'media-toolbar-remove-button'
194
193
  }];
195
194
  return items;
196
195
  };
197
- var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, widthPluginDependencyApi, getEditorFeatureFlags) {
196
+ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
197
+ var _pluginInjectionApi$d2;
198
198
  var mediaSingle = state.schema.nodes.mediaSingle;
199
199
  var allowResizing = options.allowResizing,
200
200
  allowLinking = options.allowLinking,
@@ -231,7 +231,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
231
231
  });
232
232
  }
233
233
  if (allowAdvancedToolBarOptions) {
234
- toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)((0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle, widthPluginDependencyApi, allowResizing, allowResizingInTables)));
234
+ toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)((0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, allowResizing, allowResizingInTables)));
235
235
  if (toolbarButtons.length) {
236
236
  toolbarButtons.push({
237
237
  type: 'separator'
@@ -252,14 +252,16 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
252
252
  };
253
253
  var openLink = function openLink() {
254
254
  if (editorView) {
255
- var _state2 = editorView.state,
255
+ var _pluginInjectionApi$d;
256
+ var tr = editorView.state.tr,
256
257
  dispatch = editorView.dispatch;
257
- dispatch((0, _analytics.addAnalytics)(_state2, _state2.tr, {
258
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.attachAnalyticsEvent({
258
259
  eventType: _analytics.EVENT_TYPE.TRACK,
259
260
  action: _analytics.ACTION.VISITED,
260
261
  actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
261
262
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.LINK
262
- }));
263
+ })(tr);
264
+ dispatch(tr);
263
265
  return true;
264
266
  }
265
267
  };
@@ -283,16 +285,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
283
285
  type: 'separator'
284
286
  });
285
287
  }
288
+ var _ref = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
289
+ hoverDecoration = _ref.hoverDecoration;
286
290
  var removeButton = {
287
291
  id: 'editor.media.delete',
288
292
  type: 'button',
289
293
  appearance: 'danger',
290
294
  focusEditoronEnter: true,
291
295
  icon: _remove.default,
292
- onMouseEnter: (0, _decoration.hoverDecoration)(mediaSingle, true),
293
- onMouseLeave: (0, _decoration.hoverDecoration)(mediaSingle, false),
294
- onFocus: (0, _decoration.hoverDecoration)(mediaSingle, true),
295
- onBlur: (0, _decoration.hoverDecoration)(mediaSingle, false),
296
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
297
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
298
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
299
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
296
300
  title: intl.formatMessage(_messages.default.remove),
297
301
  onClick: remove,
298
302
  testId: 'media-toolbar-remove-button'
@@ -310,6 +314,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
310
314
  return items;
311
315
  };
312
316
  var floatingToolbar = function floatingToolbar(state, intl) {
317
+ var _pluginInjectionApi$d3;
313
318
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
314
319
  var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
315
320
  var _state$schema$nodes = state.schema.nodes,
@@ -325,6 +330,8 @@ var floatingToolbar = function floatingToolbar(state, intl) {
325
330
  getEditorFeatureFlags = options.getEditorFeatureFlags;
326
331
  var mediaPluginState = _pluginKey.stateKey.getState(state);
327
332
  var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
333
+ var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
334
+ hoverDecoration = _ref2.hoverDecoration;
328
335
  if (!mediaPluginState) {
329
336
  return;
330
337
  }
@@ -363,21 +370,21 @@ var floatingToolbar = function floatingToolbar(state, intl) {
363
370
  var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
364
371
  return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
365
372
  };
366
- items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
373
+ items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
367
374
  } else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
368
375
  baseToolbar.getDomRef = function () {
369
376
  var _mediaPluginState$ele2;
370
377
  var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
371
378
  return element || mediaPluginState.element;
372
379
  };
373
- items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
380
+ items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
374
381
  } else {
375
382
  baseToolbar.getDomRef = function () {
376
383
  var _mediaPluginState$ele3;
377
384
  var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(_styles.MediaSingleNodeSelector));
378
385
  return element || mediaPluginState.element;
379
386
  };
380
- items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, getEditorFeatureFlags);
387
+ items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
381
388
  }
382
389
  return _objectSpread(_objectSpread({}, baseToolbar), {}, {
383
390
  items: items,
@@ -36,6 +36,7 @@ var insertPanelType = function insertPanelType(panelAttributes, state) {
36
36
  };
37
37
  var panelPlugin = function panelPlugin() {
38
38
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
+ var api = arguments.length > 1 ? arguments[1] : undefined;
39
40
  return {
40
41
  name: 'panel',
41
42
  nodes: function nodes() {
@@ -156,7 +157,7 @@ var panelPlugin = function panelPlugin() {
156
157
  return quickInsertOptions;
157
158
  },
158
159
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
159
- return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory);
160
+ return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
160
161
  }
161
162
  }
162
163
  };
@@ -15,7 +15,6 @@ var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/error")
15
15
  var _removeEmoji = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove-emoji"));
16
16
  var _messages = _interopRequireDefault(require("../../messages"));
17
17
  var _actions = require("./actions");
18
- var _decoration = require("../base/pm-plugins/decoration");
19
18
  var _panelBackgroundPalette = require("../../ui/ColorPalette/Palettes/panelBackgroundPalette");
20
19
  var _panel = require("@atlaskit/editor-common/panel");
21
20
  var _utils = require("./utils");
@@ -47,7 +46,7 @@ var panelIconMap = (_panelIconMap = {}, (0, _defineProperty2.default)(_panelIcon
47
46
  id: 'atlassian-tip'
48
47
  }), _panelIconMap);
49
48
  exports.panelIconMap = panelIconMap;
50
- var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon, state) {
49
+ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, activePanelType, activePanelColor, activePanelIcon, state) {
51
50
  // TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
52
51
  var items = [{
53
52
  id: 'editor.panel.info',
@@ -250,10 +249,10 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
250
249
  focusEditoronEnter: true,
251
250
  icon: _remove.default,
252
251
  onClick: (0, _actions.removePanel)(),
253
- onMouseEnter: (0, _decoration.hoverDecoration)(panelNodeType, true),
254
- onMouseLeave: (0, _decoration.hoverDecoration)(panelNodeType, false),
255
- onFocus: (0, _decoration.hoverDecoration)(panelNodeType, true),
256
- onBlur: (0, _decoration.hoverDecoration)(panelNodeType, false),
252
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
253
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
254
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
255
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
257
256
  title: formatMessage(_messages.default.remove),
258
257
  tabIndex: null
259
258
  });
@@ -263,6 +262,7 @@ exports.getToolbarItems = getToolbarItems;
263
262
  var getToolbarConfig = function getToolbarConfig(state, intl) {
264
263
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
265
264
  var providerFactory = arguments.length > 3 ? arguments[3] : undefined;
265
+ var hoverDecoration = arguments.length > 4 ? arguments[4] : undefined;
266
266
  var formatMessage = intl.formatMessage;
267
267
  var panelObject = (0, _utils.findPanel)(state);
268
268
  if (panelObject) {
@@ -276,7 +276,7 @@ var getToolbarConfig = function getToolbarConfig(state, intl) {
276
276
  };
277
277
 
278
278
  // force toolbar to be turned on
279
- var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
279
+ var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, hoverDecoration, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
280
280
  var getDomRef = function getDomRef(editorView) {
281
281
  var domAtPos = editorView.domAtPos.bind(editorView);
282
282
  var element = (0, _prosemirrorUtils.findDomRefAtPos)(panelObject.pos, domAtPos);
@@ -18,7 +18,7 @@ var _PlaceholderFloatingToolbar = _interopRequireDefault(require("./ui/Placehold
18
18
  var _actions = require("./actions");
19
19
  var _placeholderTextNodeview = require("./placeholder-text-nodeview");
20
20
  var _pluginKey = require("./plugin-key");
21
- var _analytics = require("../analytics");
21
+ var _analytics = require("@atlaskit/editor-common/analytics");
22
22
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
23
23
  var _selectionUtils = require("./selection-utils");
24
24
  var _api = require("../type-ahead/api");
@@ -194,7 +194,7 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
194
194
  }
195
195
  };
196
196
  };
197
- var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options) {
197
+ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
198
198
  if (!options.allowInserting) {
199
199
  return plugin;
200
200
  }
@@ -213,11 +213,12 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
213
213
  });
214
214
  },
215
215
  action: function action(insert, state) {
216
+ var _api$dependencies$ana;
216
217
  var tr = state.tr;
217
218
  tr.setMeta(_pluginKey.pluginKey, {
218
219
  showInsertPanelAt: tr.selection.anchor
219
220
  });
220
- return (0, _analytics.addAnalytics)(state, tr, {
221
+ api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions.attachAnalyticsEvent({
221
222
  action: _analytics.ACTION.INSERTED,
222
223
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
223
224
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
@@ -225,7 +226,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
225
226
  inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
226
227
  },
227
228
  eventType: _analytics.EVENT_TYPE.TRACK
228
- });
229
+ })(tr);
230
+ return tr;
229
231
  }
230
232
  }];
231
233
  }
@@ -233,7 +235,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
233
235
  return plugin;
234
236
  };
235
237
  var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
236
- return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
238
+ return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options, api);
237
239
  };
238
240
  var _default = placeholderTextPlugin;
239
241
  exports.default = _default;
@@ -181,6 +181,25 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
181
181
  element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
182
182
  };
183
183
  }, [ref, cancel]);
184
+
185
+ // ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
186
+ // This is the expected keyboard behaviour advised by the Accessibility team
187
+ (0, _react.useLayoutEffect)(function () {
188
+ var escape = function escape(event) {
189
+ if (event.key === 'Escape') {
190
+ cancel({
191
+ addPrefixTrigger: true,
192
+ setSelectionAt: _constants2.CloseSelectionOptions.AFTER_TEXT_INSERTED,
193
+ forceFocusOnEditor: true
194
+ });
195
+ }
196
+ };
197
+ var element = ref.current;
198
+ element === null || element === void 0 ? void 0 : element.addEventListener('keydown', escape);
199
+ return function () {
200
+ element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
201
+ };
202
+ }, [ref, cancel]);
184
203
  return (0, _react2.jsx)(_ui.Popup, {
185
204
  zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
186
205
  target: anchorElement,
@@ -16,7 +16,6 @@ var _ui = require("@atlaskit/editor-common/ui");
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  var _editor = _interopRequireDefault(require("../../editor"));
18
18
  var _editorNext = _interopRequireDefault(require("../../editor-next"));
19
- var _editorMigrationComponent = _interopRequireDefault(require("../../editor-next/editor-migration-component"));
20
19
  var _EditorWithActions = _interopRequireDefault(require("../../labs/EditorWithActions"));
21
20
  var _ChromeCollapsed = _interopRequireDefault(require("../ChromeCollapsed"));
22
21
  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); }; }
@@ -53,7 +52,7 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
53
52
  value: function render() {
54
53
  var _this2 = this;
55
54
  var child = _react.default.Children.only(this.props.children);
56
- if (child.type !== _editor.default && child.type !== _EditorWithActions.default && child.type !== _editorNext.default && child.type !== _editorMigrationComponent.default) {
55
+ if (child.type !== _editor.default && child.type !== _EditorWithActions.default && child.type !== _editorNext.default) {
57
56
  throw new Error('Expected child to be of type `Editor`');
58
57
  }
59
58
  if (!this.props.isExpanded) {
@@ -84,18 +84,20 @@ function StatelessElementBrowser(props) {
84
84
  /* Only for hitting enter to select item when focused on search bar,
85
85
  * The actual enter key press is handled on individual items level.
86
86
  */
87
+ var selectedItem = items[selectedItemIndex];
87
88
  var onItemsEnterKeyPress = (0, _react.useCallback)(function (e) {
88
89
  if (e.key !== 'Enter') {
89
90
  return;
90
91
  }
91
- props.onInsertItem(items[selectedItemIndex]);
92
- }, [props, items, selectedItemIndex]);
92
+ if (onSelectItem && selectedItem != null) {
93
+ onSelectItem(selectedItem);
94
+ }
95
+ }, [onSelectItem, selectedItem]);
93
96
 
94
97
  /**
95
98
  * On arrow key selection and clicks the selectedItemIndex will change.
96
99
  * Making sure to update parent component.
97
100
  */
98
- var selectedItem = items[selectedItemIndex];
99
101
  (0, _react.useEffect)(function () {
100
102
  if (onSelectItem && selectedItem != null) {
101
103
  onSelectItem(selectedItem);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "184.0.4";
9
+ var version = "185.0.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "184.0.4",
3
+ "version": "185.0.0",
4
4
  "sideEffects": false
5
5
  }