@atlaskit/editor-core 227.0.5 → 227.0.6

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 (80) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/composable-editor/editor-internal-compiled.js +1 -1
  3. package/dist/cjs/ui/Addon/ClickAreaBlock/clickAreaBlock-compiled.js +1 -1
  4. package/dist/cjs/ui/Appearance/Chromeless-compiled.js +1 -1
  5. package/dist/cjs/ui/Appearance/Comment/Comment-compiled.js +1 -1
  6. package/dist/cjs/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -1
  7. package/dist/cjs/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -1
  8. package/dist/cjs/ui/Appearance/FullPage/BeforeWrapper-compiled.js +1 -1
  9. package/dist/cjs/ui/Appearance/FullPage/CustomToolbarWrapper-compiled.js +1 -1
  10. package/dist/cjs/ui/Appearance/FullPage/FullPage-compiled.js +1 -1
  11. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-compiled.js +1 -1
  12. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbarNext.js +1 -1
  13. package/dist/cjs/ui/Appearance/FullPage/MainToolbar-compiled.js +1 -1
  14. package/dist/cjs/ui/Appearance/FullPage/MainToolbarWrapper-compiled.js +1 -1
  15. package/dist/cjs/ui/ChromeCollapsed/ChromeCollapsed-compiled.js +1 -1
  16. package/dist/cjs/ui/ContextPanel/index-compiled.js +1 -1
  17. package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +1 -1
  18. package/dist/cjs/ui/PluginSlot/PluginSlot-compiled.js +1 -1
  19. package/dist/cjs/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +1 -1
  20. package/dist/cjs/ui/Toolbar/ToolbarPortal.js +1 -1
  21. package/dist/cjs/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +1 -1
  22. package/dist/cjs/ui/WithFlash/withFlash-compiled.js +1 -1
  23. package/dist/cjs/ui/quick-insert/ExtensionQuickInsertMenuItem.js +3 -1
  24. package/dist/cjs/ui/quick-insert/executeExtensionQuickInsertItem.js +10 -5
  25. package/dist/cjs/ui/quick-insert/getExtensionQuickInsertComponents.js +2 -0
  26. package/dist/cjs/utils/extensions.js +1 -0
  27. package/dist/es2019/composable-editor/editor-internal-compiled.js +1 -1
  28. package/dist/es2019/ui/Addon/ClickAreaBlock/clickAreaBlock-compiled.js +1 -1
  29. package/dist/es2019/ui/Appearance/Chromeless-compiled.js +1 -1
  30. package/dist/es2019/ui/Appearance/Comment/Comment-compiled.js +1 -1
  31. package/dist/es2019/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -1
  32. package/dist/es2019/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -1
  33. package/dist/es2019/ui/Appearance/FullPage/BeforeWrapper-compiled.js +1 -1
  34. package/dist/es2019/ui/Appearance/FullPage/CustomToolbarWrapper-compiled.js +1 -1
  35. package/dist/es2019/ui/Appearance/FullPage/FullPage-compiled.js +1 -1
  36. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-compiled.js +1 -1
  37. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbarNext.js +1 -1
  38. package/dist/es2019/ui/Appearance/FullPage/MainToolbar-compiled.js +1 -1
  39. package/dist/es2019/ui/Appearance/FullPage/MainToolbarWrapper-compiled.js +1 -1
  40. package/dist/es2019/ui/ChromeCollapsed/ChromeCollapsed-compiled.js +1 -1
  41. package/dist/es2019/ui/ContextPanel/index-compiled.js +1 -1
  42. package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +1 -1
  43. package/dist/es2019/ui/PluginSlot/PluginSlot-compiled.js +1 -1
  44. package/dist/es2019/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +1 -1
  45. package/dist/es2019/ui/Toolbar/ToolbarPortal.js +1 -1
  46. package/dist/es2019/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +1 -1
  47. package/dist/es2019/ui/WithFlash/withFlash-compiled.js +1 -1
  48. package/dist/es2019/ui/quick-insert/ExtensionQuickInsertMenuItem.js +3 -1
  49. package/dist/es2019/ui/quick-insert/executeExtensionQuickInsertItem.js +10 -5
  50. package/dist/es2019/ui/quick-insert/getExtensionQuickInsertComponents.js +2 -0
  51. package/dist/es2019/utils/extensions.js +1 -0
  52. package/dist/esm/composable-editor/editor-internal-compiled.js +1 -1
  53. package/dist/esm/ui/Addon/ClickAreaBlock/clickAreaBlock-compiled.js +1 -1
  54. package/dist/esm/ui/Appearance/Chromeless-compiled.js +1 -1
  55. package/dist/esm/ui/Appearance/Comment/Comment-compiled.js +1 -1
  56. package/dist/esm/ui/Appearance/Comment/FixedToolbar-compiled.js +1 -1
  57. package/dist/esm/ui/Appearance/Comment/StickyToolbar-compiled.js +1 -1
  58. package/dist/esm/ui/Appearance/FullPage/BeforeWrapper-compiled.js +1 -1
  59. package/dist/esm/ui/Appearance/FullPage/CustomToolbarWrapper-compiled.js +1 -1
  60. package/dist/esm/ui/Appearance/FullPage/FullPage-compiled.js +1 -1
  61. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-compiled.js +1 -1
  62. package/dist/esm/ui/Appearance/FullPage/FullPageToolbarNext.js +1 -1
  63. package/dist/esm/ui/Appearance/FullPage/MainToolbar-compiled.js +1 -1
  64. package/dist/esm/ui/Appearance/FullPage/MainToolbarWrapper-compiled.js +1 -1
  65. package/dist/esm/ui/ChromeCollapsed/ChromeCollapsed-compiled.js +1 -1
  66. package/dist/esm/ui/ContextPanel/index-compiled.js +1 -1
  67. package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +1 -1
  68. package/dist/esm/ui/PluginSlot/PluginSlot-compiled.js +1 -1
  69. package/dist/esm/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +1 -1
  70. package/dist/esm/ui/Toolbar/ToolbarPortal.js +1 -1
  71. package/dist/esm/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +1 -1
  72. package/dist/esm/ui/WithFlash/withFlash-compiled.js +1 -1
  73. package/dist/esm/ui/quick-insert/ExtensionQuickInsertMenuItem.js +3 -1
  74. package/dist/esm/ui/quick-insert/executeExtensionQuickInsertItem.js +10 -5
  75. package/dist/esm/ui/quick-insert/getExtensionQuickInsertComponents.js +2 -0
  76. package/dist/esm/utils/extensions.js +1 -0
  77. package/dist/types/ui/quick-insert/ExtensionQuickInsertMenuItem.d.ts +3 -1
  78. package/dist/types/ui/quick-insert/executeExtensionQuickInsertItem.d.ts +3 -1
  79. package/dist/types/ui/quick-insert/getExtensionQuickInsertComponents.d.ts +3 -1
  80. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 227.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6857dcfa86d94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6857dcfa86d94) -
8
+ Fix asynchronous database and extension insertions in the `platform_editor_slash_command`
9
+ treatment, both when the editor API is available and when it is unavailable.
10
+ - Updated dependencies
11
+
3
12
  ## 227.0.5
4
13
 
5
14
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `editor-internal.tsx`.
@@ -1,4 +1,4 @@
1
- /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Chromeless.tsx`.
@@ -1,4 +1,4 @@
1
- /* Comment-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Comment-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Toolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `BeforeWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `CustomToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPage-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPage-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `FullPage.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* index-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* index-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarInner.tsx`.
@@ -1,4 +1,4 @@
1
- /* ToolbarPortal.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarPortal.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarWithSizeDetector.tsx`.
@@ -1,4 +1,4 @@
1
- /* withFlash-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* withFlash-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -14,6 +14,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
14
14
  var ExtensionQuickInsertMenuItem = exports.ExtensionQuickInsertMenuItem = function ExtensionQuickInsertMenuItem(_ref) {
15
15
  var apiRef = _ref.apiRef,
16
16
  createAnalyticsEvent = _ref.createAnalyticsEvent,
17
+ editorActions = _ref.editorActions,
17
18
  item = _ref.item,
18
19
  onInsert = _ref.onInsert;
19
20
  var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
@@ -25,6 +26,7 @@ var ExtensionQuickInsertMenuItem = exports.ExtensionQuickInsertMenuItem = functi
25
26
  var result = (0, _executeExtensionQuickInsertItem.executeExtensionQuickInsertItem)({
26
27
  apiRef: apiRef,
27
28
  createAnalyticsEvent: createAnalyticsEvent,
29
+ editorActions: editorActions,
28
30
  insert: insert,
29
31
  item: item,
30
32
  source: source,
@@ -34,7 +36,7 @@ var ExtensionQuickInsertMenuItem = exports.ExtensionQuickInsertMenuItem = functi
34
36
  onInsert === null || onInsert === void 0 || onInsert();
35
37
  }
36
38
  return result;
37
- }, [apiRef, createAnalyticsEvent, editorView.state, item, onInsert]);
39
+ }, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
38
40
  return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
39
41
  iconBefore: /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertIcon.ExtensionQuickInsertIcon, {
40
42
  getIcon: item.icon,
@@ -8,10 +8,10 @@ exports.executeExtensionQuickInsertItem = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _extensions = require("@atlaskit/editor-common/extensions");
11
- var _insert = require("@atlaskit/editor-common/insert");
12
11
  var _monitoring = require("@atlaskit/editor-common/monitoring");
13
12
  var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
14
13
  var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
14
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
17
  var sendAnalytics = function sendAnalytics(item, selection, createAnalyticsEvent, source) {
@@ -69,6 +69,7 @@ var dummyExtensionAPI = {
69
69
  var executeExtensionQuickInsertItem = exports.executeExtensionQuickInsertItem = function executeExtensionQuickInsertItem(_ref) {
70
70
  var apiRef = _ref.apiRef,
71
71
  createAnalyticsEvent = _ref.createAnalyticsEvent,
72
+ editorActions = _ref.editorActions,
72
73
  insert = _ref.insert,
73
74
  item = _ref.item,
74
75
  source = _ref.source,
@@ -78,12 +79,16 @@ var executeExtensionQuickInsertItem = exports.executeExtensionQuickInsertItem =
78
79
  var extensionAPI = (_apiRef$current$exten = (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api()) !== null && _apiRef$current$exten !== void 0 ? _apiRef$current$exten : dummyExtensionAPI;
79
80
  void (0, _extensions.resolveImport)(item.node(extensionAPI)).then(function (node) {
80
81
  sendAnalytics(item, state.selection, createAnalyticsEvent, source);
81
- if (node && apiRef.current) {
82
- apiRef.current.core.actions.execute(function (_ref2) {
83
- var _safeInsert$scrollInt, _safeInsert;
82
+ if (node) {
83
+ var api = apiRef.current;
84
+ if (!api) {
85
+ editorActions.replaceSelection(node);
86
+ return;
87
+ }
88
+ api.core.actions.execute(function (_ref2) {
84
89
  var tr = _ref2.tr;
85
90
  var content = (0, _processRawValue.processRawValue)(tr.doc.type.schema, node);
86
- return content ? (_safeInsert$scrollInt = (_safeInsert = (0, _insert.safeInsert)(content)(tr)) === null || _safeInsert === void 0 ? void 0 : _safeInsert.scrollIntoView()) !== null && _safeInsert$scrollInt !== void 0 ? _safeInsert$scrollInt : null : null;
91
+ return content ? (0, _utils.safeInsert)(content)(tr).scrollIntoView() : null;
87
92
  });
88
93
  }
89
94
  }).catch(function (error) {
@@ -67,6 +67,7 @@ var getFallbackRank = function getFallbackRank(_ref) {
67
67
  var getExtensionQuickInsertComponents = exports.getExtensionQuickInsertComponents = function getExtensionQuickInsertComponents(_ref3) {
68
68
  var apiRef = _ref3.apiRef,
69
69
  createAnalyticsEvent = _ref3.createAnalyticsEvent,
70
+ editorActions = _ref3.editorActions,
70
71
  items = _ref3.items;
71
72
  var unrecognizedStructureItemRanks = getUnrecognizedStructureItemRanks(items);
72
73
  var unrecognizedDataAndChartsItemRanks = getUnrecognizedDataAndChartsItemRanks(items);
@@ -99,6 +100,7 @@ var getExtensionQuickInsertComponents = exports.getExtensionQuickInsertComponent
99
100
  return /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertMenuItem.ExtensionQuickInsertMenuItem, {
100
101
  apiRef: apiRef,
101
102
  createAnalyticsEvent: createAnalyticsEvent,
103
+ editorActions: editorActions,
102
104
  item: item,
103
105
  onInsert: props.onInsert
104
106
  });
@@ -107,6 +107,7 @@ function _extensionProviderToQuickInsertProvider() {
107
107
  return Promise.resolve((0, _getExtensionQuickInsertComponents.getExtensionQuickInsertComponents)({
108
108
  apiRef: apiRef,
109
109
  createAnalyticsEvent: createAnalyticsEvent,
110
+ editorActions: editorActions,
110
111
  items: getMenuItems()
111
112
  }));
112
113
  },
@@ -1,4 +1,4 @@
1
- /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `editor-internal.tsx`.
@@ -1,4 +1,4 @@
1
- /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./clickAreaBlock-compiled.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Chromeless.tsx`.
@@ -1,4 +1,4 @@
1
- /* Comment-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Comment-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Comment.tsx`.
@@ -1,4 +1,4 @@
1
- /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Toolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Toolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `BeforeWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `CustomToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPage-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPage-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `FullPage.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./FullPageContentArea-compiled.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useImperativeHandle, useRef } from 'react';
@@ -1,4 +1,4 @@
1
- /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./FullPageToolbarNext.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useMemo } from 'react';
@@ -1,4 +1,4 @@
1
- /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./ChromeCollapsed-compiled.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* index-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index-compiled.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  // oxlint-disable-next-line typescript-eslint/triple-slash-reference
3
3
  /// <reference path="../../types/compiled-shims.d.ts" />
4
4
  // TODO: EDITOR-6833 - Expected across this entire file, future violations are expected. Will try to remove them later after fully migration
@@ -1,4 +1,4 @@
1
- /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./PluginSlot-compiled.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarInner.tsx`.
@@ -1,4 +1,4 @@
1
- /* ToolbarPortal.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarPortal.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./ToolbarPortal.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarWithSizeDetector.tsx`.
@@ -1,4 +1,4 @@
1
- /* withFlash-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* withFlash-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import "./withFlash-compiled.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -6,6 +6,7 @@ import { ExtensionQuickInsertIcon } from './ExtensionQuickInsertIcon';
6
6
  export const ExtensionQuickInsertMenuItem = ({
7
7
  apiRef,
8
8
  createAnalyticsEvent,
9
+ editorActions,
9
10
  item,
10
11
  onInsert
11
12
  }) => {
@@ -20,6 +21,7 @@ export const ExtensionQuickInsertMenuItem = ({
20
21
  const result = executeExtensionQuickInsertItem({
21
22
  apiRef,
22
23
  createAnalyticsEvent,
24
+ editorActions,
23
25
  insert,
24
26
  item,
25
27
  source,
@@ -29,7 +31,7 @@ export const ExtensionQuickInsertMenuItem = ({
29
31
  onInsert === null || onInsert === void 0 ? void 0 : onInsert();
30
32
  }
31
33
  return result;
32
- }, [apiRef, createAnalyticsEvent, editorView.state, item, onInsert]);
34
+ }, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
33
35
  return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
34
36
  iconBefore: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
35
37
  getIcon: item.icon,
@@ -1,9 +1,9 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { resolveImport } from '@atlaskit/editor-common/extensions';
3
- import { safeInsert } from '@atlaskit/editor-common/insert';
4
3
  import { logException } from '@atlaskit/editor-common/monitoring';
5
4
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
6
5
  import { findInsertLocation } from '@atlaskit/editor-common/utils/analytics';
6
+ import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
7
7
  const sendAnalytics = (item, selection, createAnalyticsEvent, source) => {
8
8
  if (createAnalyticsEvent) {
9
9
  const insertLocation = findInsertLocation(selection);
@@ -48,6 +48,7 @@ const dummyExtensionAPI = {
48
48
  export const executeExtensionQuickInsertItem = ({
49
49
  apiRef,
50
50
  createAnalyticsEvent,
51
+ editorActions,
51
52
  insert,
52
53
  item,
53
54
  source,
@@ -58,13 +59,17 @@ export const executeExtensionQuickInsertItem = ({
58
59
  const extensionAPI = (_apiRef$current$exten = (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : (_apiRef$current$exten2 = _apiRef$current.extension) === null || _apiRef$current$exten2 === void 0 ? void 0 : (_apiRef$current$exten3 = _apiRef$current$exten2.actions) === null || _apiRef$current$exten3 === void 0 ? void 0 : _apiRef$current$exten3.api()) !== null && _apiRef$current$exten !== void 0 ? _apiRef$current$exten : dummyExtensionAPI;
59
60
  void resolveImport(item.node(extensionAPI)).then(node => {
60
61
  sendAnalytics(item, state.selection, createAnalyticsEvent, source);
61
- if (node && apiRef.current) {
62
- apiRef.current.core.actions.execute(({
62
+ if (node) {
63
+ const api = apiRef.current;
64
+ if (!api) {
65
+ editorActions.replaceSelection(node);
66
+ return;
67
+ }
68
+ api.core.actions.execute(({
63
69
  tr
64
70
  }) => {
65
- var _safeInsert$scrollInt, _safeInsert;
66
71
  const content = processRawValue(tr.doc.type.schema, node);
67
- return content ? (_safeInsert$scrollInt = (_safeInsert = safeInsert(content)(tr)) === null || _safeInsert === void 0 ? void 0 : _safeInsert.scrollIntoView()) !== null && _safeInsert$scrollInt !== void 0 ? _safeInsert$scrollInt : null : null;
72
+ return content ? safeInsert(content)(tr).scrollIntoView() : null;
68
73
  });
69
74
  }
70
75
  }).catch(error => logException(error, {
@@ -41,6 +41,7 @@ const getFallbackRank = ({
41
41
  export const getExtensionQuickInsertComponents = ({
42
42
  apiRef,
43
43
  createAnalyticsEvent,
44
+ editorActions,
44
45
  items
45
46
  }) => {
46
47
  const unrecognizedStructureItemRanks = getUnrecognizedStructureItemRanks(items);
@@ -72,6 +73,7 @@ export const getExtensionQuickInsertComponents = ({
72
73
  return /*#__PURE__*/React.createElement(ExtensionQuickInsertMenuItem, {
73
74
  apiRef: apiRef,
74
75
  createAnalyticsEvent: createAnalyticsEvent,
76
+ editorActions: editorActions,
75
77
  item: item,
76
78
  onInsert: props.onInsert
77
79
  });
@@ -70,6 +70,7 @@ export async function extensionProviderToQuickInsertProvider(extensionProvider,
70
70
  return Promise.resolve(getExtensionQuickInsertComponents({
71
71
  apiRef,
72
72
  createAnalyticsEvent,
73
+ editorActions,
73
74
  items: getMenuItems()
74
75
  }));
75
76
  },
@@ -1,4 +1,4 @@
1
- /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* editor-internal-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `editor-internal.tsx`.
@@ -1,4 +1,4 @@
1
- /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* clickAreaBlock-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["children"];
@@ -1,4 +1,4 @@
1
- /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Chromeless-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Chromeless.tsx`.
@@ -1,4 +1,4 @@
1
- /* Comment-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* Comment-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import "./Comment-compiled.compiled.css";
@@ -1,4 +1,4 @@
1
- /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `Toolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./StickyToolbar-compiled.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* BeforeWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `BeforeWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* CustomToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `CustomToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPage-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPage-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `FullPage.tsx`.
@@ -1,4 +1,4 @@
1
- /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageContentArea-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./FullPageContentArea-compiled.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useImperativeHandle, useRef } from 'react';
@@ -1,4 +1,4 @@
1
- /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* FullPageToolbarNext.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./FullPageToolbarNext.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useMemo } from 'react';
@@ -1,4 +1,4 @@
1
- /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbar-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbar.tsx`.
@@ -1,4 +1,4 @@
1
- /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* MainToolbarWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `MainToolbarWrapper.tsx`.
@@ -1,4 +1,4 @@
1
- /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ChromeCollapsed-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import "./ChromeCollapsed-compiled.compiled.css";
@@ -1,4 +1,4 @@
1
- /* index-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* index-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["children", "customWidth", "visible", "disableAnimation"],
@@ -1,4 +1,4 @@
1
- /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* EditorContentContainer-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import "./EditorContentContainer-compiled.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* PluginSlot-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["children"];
@@ -1,4 +1,4 @@
1
- /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarInner.tsx`.
@@ -1,4 +1,4 @@
1
- /* ToolbarPortal.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarPortal.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import "./ToolbarPortal.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  /**
3
3
  * Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
4
4
  * Used via `componentWithCondition` in `ToolbarWithSizeDetector.tsx`.
@@ -1,4 +1,4 @@
1
- /* withFlash-compiled.tsx generated by @compiled/babel-plugin v2.0.0 */
1
+ /* withFlash-compiled.tsx generated by @compiled/babel-plugin v3.0.1 */
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -6,6 +6,7 @@ import { ExtensionQuickInsertIcon } from './ExtensionQuickInsertIcon';
6
6
  export var ExtensionQuickInsertMenuItem = function ExtensionQuickInsertMenuItem(_ref) {
7
7
  var apiRef = _ref.apiRef,
8
8
  createAnalyticsEvent = _ref.createAnalyticsEvent,
9
+ editorActions = _ref.editorActions,
9
10
  item = _ref.item,
10
11
  onInsert = _ref.onInsert;
11
12
  var _useQuickInsertContex = useQuickInsertContext(),
@@ -17,6 +18,7 @@ export var ExtensionQuickInsertMenuItem = function ExtensionQuickInsertMenuItem(
17
18
  var result = executeExtensionQuickInsertItem({
18
19
  apiRef: apiRef,
19
20
  createAnalyticsEvent: createAnalyticsEvent,
21
+ editorActions: editorActions,
20
22
  insert: insert,
21
23
  item: item,
22
24
  source: source,
@@ -26,7 +28,7 @@ export var ExtensionQuickInsertMenuItem = function ExtensionQuickInsertMenuItem(
26
28
  onInsert === null || onInsert === void 0 || onInsert();
27
29
  }
28
30
  return result;
29
- }, [apiRef, createAnalyticsEvent, editorView.state, item, onInsert]);
31
+ }, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
30
32
  return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
31
33
  iconBefore: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
32
34
  getIcon: item.icon,
@@ -3,10 +3,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { resolveImport } from '@atlaskit/editor-common/extensions';
6
- import { safeInsert } from '@atlaskit/editor-common/insert';
7
6
  import { logException } from '@atlaskit/editor-common/monitoring';
8
7
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
9
8
  import { findInsertLocation } from '@atlaskit/editor-common/utils/analytics';
9
+ import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
10
10
  var sendAnalytics = function sendAnalytics(item, selection, createAnalyticsEvent, source) {
11
11
  if (createAnalyticsEvent) {
12
12
  var insertLocation = findInsertLocation(selection);
@@ -62,6 +62,7 @@ var dummyExtensionAPI = {
62
62
  export var executeExtensionQuickInsertItem = function executeExtensionQuickInsertItem(_ref) {
63
63
  var apiRef = _ref.apiRef,
64
64
  createAnalyticsEvent = _ref.createAnalyticsEvent,
65
+ editorActions = _ref.editorActions,
65
66
  insert = _ref.insert,
66
67
  item = _ref.item,
67
68
  source = _ref.source,
@@ -71,12 +72,16 @@ export var executeExtensionQuickInsertItem = function executeExtensionQuickInser
71
72
  var extensionAPI = (_apiRef$current$exten = (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.extension) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.actions) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.api()) !== null && _apiRef$current$exten !== void 0 ? _apiRef$current$exten : dummyExtensionAPI;
72
73
  void resolveImport(item.node(extensionAPI)).then(function (node) {
73
74
  sendAnalytics(item, state.selection, createAnalyticsEvent, source);
74
- if (node && apiRef.current) {
75
- apiRef.current.core.actions.execute(function (_ref2) {
76
- var _safeInsert$scrollInt, _safeInsert;
75
+ if (node) {
76
+ var api = apiRef.current;
77
+ if (!api) {
78
+ editorActions.replaceSelection(node);
79
+ return;
80
+ }
81
+ api.core.actions.execute(function (_ref2) {
77
82
  var tr = _ref2.tr;
78
83
  var content = processRawValue(tr.doc.type.schema, node);
79
- return content ? (_safeInsert$scrollInt = (_safeInsert = safeInsert(content)(tr)) === null || _safeInsert === void 0 ? void 0 : _safeInsert.scrollIntoView()) !== null && _safeInsert$scrollInt !== void 0 ? _safeInsert$scrollInt : null : null;
84
+ return content ? safeInsert(content)(tr).scrollIntoView() : null;
80
85
  });
81
86
  }
82
87
  }).catch(function (error) {
@@ -60,6 +60,7 @@ var getFallbackRank = function getFallbackRank(_ref) {
60
60
  export var getExtensionQuickInsertComponents = function getExtensionQuickInsertComponents(_ref3) {
61
61
  var apiRef = _ref3.apiRef,
62
62
  createAnalyticsEvent = _ref3.createAnalyticsEvent,
63
+ editorActions = _ref3.editorActions,
63
64
  items = _ref3.items;
64
65
  var unrecognizedStructureItemRanks = getUnrecognizedStructureItemRanks(items);
65
66
  var unrecognizedDataAndChartsItemRanks = getUnrecognizedDataAndChartsItemRanks(items);
@@ -92,6 +93,7 @@ export var getExtensionQuickInsertComponents = function getExtensionQuickInsertC
92
93
  return /*#__PURE__*/React.createElement(ExtensionQuickInsertMenuItem, {
93
94
  apiRef: apiRef,
94
95
  createAnalyticsEvent: createAnalyticsEvent,
96
+ editorActions: editorActions,
95
97
  item: item,
96
98
  onInsert: props.onInsert
97
99
  });
@@ -101,6 +101,7 @@ function _extensionProviderToQuickInsertProvider() {
101
101
  return Promise.resolve(getExtensionQuickInsertComponents({
102
102
  apiRef: apiRef,
103
103
  createAnalyticsEvent: createAnalyticsEvent,
104
+ editorActions: editorActions,
104
105
  items: getMenuItems()
105
106
  }));
106
107
  },
@@ -3,9 +3,11 @@ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
3
  import type { MenuItem } from '@atlaskit/editor-common/extensions';
4
4
  import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
5
5
  import type { ExtensionPlugin } from '@atlaskit/editor-plugins/extension';
6
- export declare const ExtensionQuickInsertMenuItem: ({ apiRef, createAnalyticsEvent, item, onInsert, }: {
6
+ import type EditorActions from '../../actions';
7
+ export declare const ExtensionQuickInsertMenuItem: ({ apiRef, createAnalyticsEvent, editorActions, item, onInsert, }: {
7
8
  apiRef: React.MutableRefObject<PublicPluginAPI<[ExtensionPlugin]> | undefined>;
8
9
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
10
+ editorActions: EditorActions;
9
11
  item: MenuItem;
10
12
  onInsert?: () => void;
11
13
  }) => React.JSX.Element;
@@ -6,9 +6,11 @@ import type { MenuItem } from '@atlaskit/editor-common/extensions';
6
6
  import type { QuickInsertActionInsert } from '@atlaskit/editor-common/provider-factory';
7
7
  import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
8
8
  import type { ExtensionPlugin } from '@atlaskit/editor-plugins/extension';
9
- export declare const executeExtensionQuickInsertItem: ({ apiRef, createAnalyticsEvent, insert, item, source, state, }: {
9
+ import type EditorActions from '../../actions';
10
+ export declare const executeExtensionQuickInsertItem: ({ apiRef, createAnalyticsEvent, editorActions, insert, item, source, state, }: {
10
11
  apiRef: React.MutableRefObject<PublicPluginAPI<[ExtensionPlugin]> | undefined>;
11
12
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
13
+ editorActions: EditorActions;
12
14
  insert: QuickInsertActionInsert;
13
15
  item: MenuItem;
14
16
  source?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.ELEMENT_BROWSER;
@@ -4,12 +4,14 @@ import type { MenuItem } from '@atlaskit/editor-common/extensions';
4
4
  import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
5
5
  import type { ExtensionPlugin } from '@atlaskit/editor-plugins/extension';
6
6
  import type { CommonComponentProps, RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
7
+ import type EditorActions from '../../actions';
7
8
  type ExtensionQuickInsertComponentProps = CommonComponentProps & {
8
9
  onInsert?: () => void;
9
10
  };
10
- export declare const getExtensionQuickInsertComponents: ({ apiRef, createAnalyticsEvent, items, }: {
11
+ export declare const getExtensionQuickInsertComponents: ({ apiRef, createAnalyticsEvent, editorActions, items, }: {
11
12
  apiRef: React.MutableRefObject<PublicPluginAPI<[ExtensionPlugin]> | undefined>;
12
13
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
14
+ editorActions: EditorActions;
13
15
  items: MenuItem[];
14
16
  }) => RegisterMenuItem<ExtensionQuickInsertComponentProps>[];
15
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "227.0.5",
3
+ "version": "227.0.6",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"