@atlaskit/editor-core 189.3.18 → 189.3.20

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 (213) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/actions/index.js +6 -5
  3. package/dist/cjs/plugins/avatar-group/index.js +3 -1
  4. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
  5. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +2 -2
  6. package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  7. package/dist/cjs/plugins/collab-edit/ui/avatars.js +1 -1
  8. package/dist/cjs/plugins/collab-edit/utils.js +2 -3
  9. package/dist/cjs/plugins/extension/actions.js +2 -3
  10. package/dist/cjs/plugins/extension/context-panel.js +117 -107
  11. package/dist/cjs/plugins/extension/extension-api.js +1 -1
  12. package/dist/cjs/plugins/extension/index.js +4 -1
  13. package/dist/cjs/plugins/extension/plugin-factory.js +2 -2
  14. package/dist/cjs/plugins/extension/pm-plugins/unique-id.js +2 -2
  15. package/dist/cjs/plugins/extension/toolbar.js +1 -1
  16. package/dist/cjs/plugins/extension/utils.js +4 -5
  17. package/dist/cjs/plugins/find-replace/plugin.js +3 -3
  18. package/dist/cjs/plugins/index.js +0 -7
  19. package/dist/cjs/presets/default.js +0 -11
  20. package/dist/cjs/test-utils.js +1 -8
  21. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
  22. package/dist/cjs/ui/ContentStyles/index.js +4 -4
  23. package/dist/cjs/ui/ToolbarFeedback/index.js +2 -2
  24. package/dist/cjs/ui/WithHelpTrigger/index.js +2 -2
  25. package/dist/cjs/utils/nodes-by-localIds.js +1 -29
  26. package/dist/cjs/utils/selection.js +1 -15
  27. package/dist/cjs/version-wrapper.js +1 -1
  28. package/dist/es2019/actions/index.js +5 -4
  29. package/dist/es2019/plugins/avatar-group/index.js +3 -1
  30. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
  31. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +1 -1
  32. package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  33. package/dist/es2019/plugins/collab-edit/ui/avatars.js +1 -1
  34. package/dist/es2019/plugins/collab-edit/utils.js +2 -3
  35. package/dist/es2019/plugins/extension/actions.js +1 -2
  36. package/dist/es2019/plugins/extension/context-panel.js +55 -47
  37. package/dist/es2019/plugins/extension/extension-api.js +1 -1
  38. package/dist/es2019/plugins/extension/index.js +4 -1
  39. package/dist/es2019/plugins/extension/plugin-factory.js +1 -1
  40. package/dist/es2019/plugins/extension/pm-plugins/macro/actions.js +1 -2
  41. package/dist/es2019/plugins/extension/pm-plugins/unique-id.js +1 -1
  42. package/dist/es2019/plugins/extension/toolbar.js +1 -1
  43. package/dist/es2019/plugins/extension/utils.js +1 -2
  44. package/dist/es2019/plugins/find-replace/plugin.js +1 -1
  45. package/dist/es2019/plugins/index.js +0 -1
  46. package/dist/es2019/presets/default.js +0 -13
  47. package/dist/es2019/test-utils.js +0 -5
  48. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
  49. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  50. package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
  51. package/dist/es2019/ui/WithHelpTrigger/index.js +1 -1
  52. package/dist/es2019/utils/nodes-by-localIds.js +0 -27
  53. package/dist/es2019/utils/selection.js +0 -14
  54. package/dist/es2019/version-wrapper.js +1 -1
  55. package/dist/esm/actions/index.js +5 -4
  56. package/dist/esm/plugins/avatar-group/index.js +3 -1
  57. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
  58. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +1 -1
  59. package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
  60. package/dist/esm/plugins/collab-edit/ui/avatars.js +1 -1
  61. package/dist/esm/plugins/collab-edit/utils.js +2 -3
  62. package/dist/esm/plugins/extension/actions.js +1 -2
  63. package/dist/esm/plugins/extension/context-panel.js +115 -105
  64. package/dist/esm/plugins/extension/extension-api.js +1 -1
  65. package/dist/esm/plugins/extension/index.js +4 -1
  66. package/dist/esm/plugins/extension/plugin-factory.js +1 -1
  67. package/dist/esm/plugins/extension/pm-plugins/macro/actions.js +1 -2
  68. package/dist/esm/plugins/extension/pm-plugins/unique-id.js +1 -1
  69. package/dist/esm/plugins/extension/toolbar.js +1 -1
  70. package/dist/esm/plugins/extension/utils.js +1 -2
  71. package/dist/esm/plugins/find-replace/plugin.js +1 -1
  72. package/dist/esm/plugins/index.js +0 -1
  73. package/dist/esm/presets/default.js +0 -11
  74. package/dist/esm/test-utils.js +0 -5
  75. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
  76. package/dist/esm/ui/ContentStyles/index.js +1 -1
  77. package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
  78. package/dist/esm/ui/WithHelpTrigger/index.js +1 -1
  79. package/dist/esm/utils/nodes-by-localIds.js +0 -28
  80. package/dist/esm/utils/selection.js +0 -14
  81. package/dist/esm/version-wrapper.js +1 -1
  82. package/dist/types/plugins/avatar-group/index.d.ts +3 -2
  83. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -1
  84. package/dist/types/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
  85. package/dist/types/plugins/collab-edit/ui/avatars.d.ts +2 -0
  86. package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
  87. package/dist/types/plugins/extension/actions.d.ts +1 -1
  88. package/dist/types/plugins/extension/context-panel.d.ts +4 -2
  89. package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -4
  90. package/dist/types/plugins/extension/plugin-factory.d.ts +1 -1
  91. package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -4
  92. package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
  93. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
  94. package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -3
  95. package/dist/types/plugins/extension/utils.d.ts +1 -2
  96. package/dist/types/plugins/index.d.ts +0 -1
  97. package/dist/types/test-utils.d.ts +1 -2
  98. package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  99. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  100. package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
  101. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  102. package/dist/types/utils/document.d.ts +1 -1
  103. package/dist/types/utils/nodes-by-localIds.d.ts +0 -5
  104. package/dist/types/utils/selection.d.ts +1 -3
  105. package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +4 -2
  106. package/dist/types-ts4.5/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -1
  107. package/dist/types-ts4.5/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
  108. package/dist/types-ts4.5/plugins/collab-edit/ui/avatars.d.ts +2 -0
  109. package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
  110. package/dist/types-ts4.5/plugins/extension/actions.d.ts +1 -1
  111. package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +4 -2
  112. package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -4
  113. package/dist/types-ts4.5/plugins/extension/plugin-factory.d.ts +1 -1
  114. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +2 -4
  115. package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
  116. package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
  117. package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +2 -3
  118. package/dist/types-ts4.5/plugins/extension/utils.d.ts +1 -2
  119. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  120. package/dist/types-ts4.5/test-utils.d.ts +1 -2
  121. package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
  122. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  123. package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
  124. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  125. package/dist/types-ts4.5/utils/document.d.ts +1 -1
  126. package/dist/types-ts4.5/utils/nodes-by-localIds.d.ts +0 -5
  127. package/dist/types-ts4.5/utils/selection.d.ts +1 -3
  128. package/package.json +5 -8
  129. package/dist/cjs/plugins/analytics/consts.js +0 -10
  130. package/dist/cjs/plugins/analytics/index.js +0 -16
  131. package/dist/cjs/plugins/analytics/plugin-key.js +0 -14
  132. package/dist/cjs/plugins/analytics/plugin.js +0 -131
  133. package/dist/cjs/plugins/analytics/types/dispatch-analytics-event.js +0 -5
  134. package/dist/cjs/plugins/analytics/types/enums.js +0 -54
  135. package/dist/cjs/plugins/analytics/types/events.js +0 -5
  136. package/dist/cjs/plugins/analytics/types/extension-events.js +0 -24
  137. package/dist/cjs/plugins/analytics/types/general-events.js +0 -30
  138. package/dist/cjs/plugins/analytics/types/index.js +0 -128
  139. package/dist/cjs/plugins/analytics/types/inline-comment-events.js +0 -12
  140. package/dist/cjs/plugins/analytics/types/link-tool-bar-events.js +0 -5
  141. package/dist/cjs/plugins/analytics/types/media-events.js +0 -5
  142. package/dist/cjs/plugins/analytics/types/node-events.js +0 -18
  143. package/dist/cjs/plugins/analytics/utils.js +0 -35
  144. package/dist/cjs/utils/step.js +0 -24
  145. package/dist/es2019/plugins/analytics/consts.js +0 -4
  146. package/dist/es2019/plugins/analytics/index.js +0 -3
  147. package/dist/es2019/plugins/analytics/plugin-key.js +0 -9
  148. package/dist/es2019/plugins/analytics/plugin.js +0 -111
  149. package/dist/es2019/plugins/analytics/types/dispatch-analytics-event.js +0 -1
  150. package/dist/es2019/plugins/analytics/types/enums.js +0 -1
  151. package/dist/es2019/plugins/analytics/types/events.js +0 -1
  152. package/dist/es2019/plugins/analytics/types/extension-events.js +0 -1
  153. package/dist/es2019/plugins/analytics/types/general-events.js +0 -1
  154. package/dist/es2019/plugins/analytics/types/index.js +0 -3
  155. package/dist/es2019/plugins/analytics/types/inline-comment-events.js +0 -1
  156. package/dist/es2019/plugins/analytics/types/link-tool-bar-events.js +0 -1
  157. package/dist/es2019/plugins/analytics/types/media-events.js +0 -1
  158. package/dist/es2019/plugins/analytics/types/node-events.js +0 -1
  159. package/dist/es2019/plugins/analytics/utils.js +0 -28
  160. package/dist/es2019/utils/step.js +0 -1
  161. package/dist/esm/plugins/analytics/consts.js +0 -4
  162. package/dist/esm/plugins/analytics/index.js +0 -3
  163. package/dist/esm/plugins/analytics/plugin-key.js +0 -9
  164. package/dist/esm/plugins/analytics/plugin.js +0 -123
  165. package/dist/esm/plugins/analytics/types/dispatch-analytics-event.js +0 -1
  166. package/dist/esm/plugins/analytics/types/enums.js +0 -1
  167. package/dist/esm/plugins/analytics/types/events.js +0 -1
  168. package/dist/esm/plugins/analytics/types/extension-events.js +0 -1
  169. package/dist/esm/plugins/analytics/types/general-events.js +0 -1
  170. package/dist/esm/plugins/analytics/types/index.js +0 -3
  171. package/dist/esm/plugins/analytics/types/inline-comment-events.js +0 -1
  172. package/dist/esm/plugins/analytics/types/link-tool-bar-events.js +0 -1
  173. package/dist/esm/plugins/analytics/types/media-events.js +0 -1
  174. package/dist/esm/plugins/analytics/types/node-events.js +0 -1
  175. package/dist/esm/plugins/analytics/utils.js +0 -29
  176. package/dist/esm/utils/step.js +0 -1
  177. package/dist/types/plugins/analytics/consts.d.ts +0 -3
  178. package/dist/types/plugins/analytics/index.d.ts +0 -3
  179. package/dist/types/plugins/analytics/plugin-key.d.ts +0 -8
  180. package/dist/types/plugins/analytics/plugin.d.ts +0 -26
  181. package/dist/types/plugins/analytics/types/dispatch-analytics-event.d.ts +0 -1
  182. package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
  183. package/dist/types/plugins/analytics/types/events.d.ts +0 -1
  184. package/dist/types/plugins/analytics/types/extension-events.d.ts +0 -2
  185. package/dist/types/plugins/analytics/types/general-events.d.ts +0 -2
  186. package/dist/types/plugins/analytics/types/index.d.ts +0 -9
  187. package/dist/types/plugins/analytics/types/inline-comment-events.d.ts +0 -2
  188. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +0 -1
  189. package/dist/types/plugins/analytics/types/media-events.d.ts +0 -1
  190. package/dist/types/plugins/analytics/types/node-events.d.ts +0 -2
  191. package/dist/types/plugins/analytics/utils.d.ts +0 -11
  192. package/dist/types/utils/step.d.ts +0 -1
  193. package/dist/types-ts4.5/plugins/analytics/consts.d.ts +0 -3
  194. package/dist/types-ts4.5/plugins/analytics/index.d.ts +0 -3
  195. package/dist/types-ts4.5/plugins/analytics/plugin-key.d.ts +0 -8
  196. package/dist/types-ts4.5/plugins/analytics/plugin.d.ts +0 -29
  197. package/dist/types-ts4.5/plugins/analytics/types/dispatch-analytics-event.d.ts +0 -1
  198. package/dist/types-ts4.5/plugins/analytics/types/enums.d.ts +0 -1
  199. package/dist/types-ts4.5/plugins/analytics/types/events.d.ts +0 -1
  200. package/dist/types-ts4.5/plugins/analytics/types/extension-events.d.ts +0 -2
  201. package/dist/types-ts4.5/plugins/analytics/types/general-events.d.ts +0 -2
  202. package/dist/types-ts4.5/plugins/analytics/types/index.d.ts +0 -9
  203. package/dist/types-ts4.5/plugins/analytics/types/inline-comment-events.d.ts +0 -2
  204. package/dist/types-ts4.5/plugins/analytics/types/link-tool-bar-events.d.ts +0 -1
  205. package/dist/types-ts4.5/plugins/analytics/types/media-events.d.ts +0 -1
  206. package/dist/types-ts4.5/plugins/analytics/types/node-events.d.ts +0 -2
  207. package/dist/types-ts4.5/plugins/analytics/utils.d.ts +0 -11
  208. package/dist/types-ts4.5/utils/step.d.ts +0 -1
  209. /package/dist/cjs/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
  210. /package/dist/es2019/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
  211. /package/dist/esm/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
  212. /package/dist/types/{plugins/extension/ui/styles.d.ts → ui/ContentStyles/extension.d.ts} +0 -0
  213. /package/dist/types-ts4.5/{plugins/extension/ui/styles.d.ts → ui/ContentStyles/extension.d.ts} +0 -0
@@ -23,7 +23,6 @@ var _editorPluginFeatureFlags = require("@atlaskit/editor-plugin-feature-flags")
23
23
  var _editorPluginCopyButton = require("@atlaskit/editor-plugin-copy-button");
24
24
  var _editorPluginFloatingToolbar = require("@atlaskit/editor-plugin-floating-toolbar");
25
25
  var _editorPluginClipboard = require("@atlaskit/editor-plugin-clipboard");
26
- var _plugins = require("../plugins");
27
26
  var _editorPluginAnalytics = require("@atlaskit/editor-plugin-analytics");
28
27
  var _editorPluginPlaceholder = require("@atlaskit/editor-plugin-placeholder");
29
28
  var _annotation = _interopRequireDefault(require("../plugins/annotation"));
@@ -55,16 +54,6 @@ function createDefaultPreset(options) {
55
54
  }]);
56
55
  }
57
56
  return builder;
58
- }).maybeAdd(_plugins.analyticsPlugin, function (plugin, builder) {
59
- if (options.allowAnalyticsGASV3) {
60
- var performanceTracking = options.performanceTracking,
61
- createAnalyticsEvent = options.createAnalyticsEvent;
62
- return builder.add([plugin, {
63
- createAnalyticsEvent: createAnalyticsEvent,
64
- performanceTracking: performanceTracking
65
- }]);
66
- }
67
- return builder;
68
57
  }).add(_editorPluginBetterTypeHistory.betterTypeHistoryPlugin).add([_paste.default, options.paste]).add(_editorPluginClipboard.clipboardPlugin).add(_editorPluginFocus.focusPlugin).add(_editorPluginComposition.compositionPlugin).add([_editorPluginBase.basePlugin, options.base]).add(_editorPluginDecorations.decorationsPlugin).maybeAdd(_undoRedo.default, function (p, builder) {
69
58
  var _options$featureFlags;
70
59
  // The undo redo plugin needs to be add before the blockTypePlugin
@@ -22,9 +22,7 @@ Object.defineProperty(exports, "GapCursorSide", {
22
22
  return _selection.Side;
23
23
  }
24
24
  });
25
- exports.createPMSchemaAndPlugins = void 0;
26
- exports.getFireAnalytics = getFireAnalytics;
27
- exports.isElementBySelectorInDocument = void 0;
25
+ exports.isElementBySelectorInDocument = exports.createPMSchemaAndPlugins = void 0;
28
26
  exports.setTextSelection = setTextSelection;
29
27
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
28
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -32,16 +30,11 @@ var _state = require("@atlaskit/editor-prosemirror/state");
32
30
  var _preset = require("@atlaskit/editor-common/preset");
33
31
  var _createSchema = require("./create-editor/create-schema");
34
32
  var _sortByOrder = require("./create-editor/sort-by-order");
35
- var _pluginKey = require("./plugins/analytics/plugin-key");
36
33
  var _editorPluginBase = require("@atlaskit/editor-plugin-base");
37
34
  var _eventDispatcher = require("./event-dispatcher");
38
35
  var _selection = require("@atlaskit/editor-common/selection");
39
36
  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; }
40
37
  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; }
41
- function getFireAnalytics(editorView) {
42
- var _analyticsPluginKey$g;
43
- return _pluginKey.analyticsPluginKey === null || _pluginKey.analyticsPluginKey === void 0 || (_analyticsPluginKey$g = _pluginKey.analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
44
- }
45
38
  function lightProcessPluginsList(editorPlugins) {
46
39
  /**
47
40
  * First pass to collect pluginsOptions
@@ -24,7 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
24
24
  /** @jsx jsx */
25
25
 
26
26
  var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(function (props) {
27
- var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _editorAPI$analytics;
27
+ var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _editorAPI$analytics, _editorAPI$analytics2;
28
28
  var _useState = (0, _react.useState)(false),
29
29
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
30
  shouldSplitToolbar = _useState2[0],
@@ -68,7 +68,8 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
68
68
  inviteToEditComponent: (_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.inviteToEditComponent,
69
69
  inviteToEditHandler: (_props$collabEdit2 = props.collabEdit) === null || _props$collabEdit2 === void 0 ? void 0 : _props$collabEdit2.inviteToEditHandler,
70
70
  isInviteToEditButtonSelected: (_props$collabEdit3 = props.collabEdit) === null || _props$collabEdit3 === void 0 ? void 0 : _props$collabEdit3.isInviteToEditButtonSelected,
71
- featureFlags: props.featureFlags || {}
71
+ featureFlags: props.featureFlags || {},
72
+ editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions
72
73
  }), editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? (0, _react2.jsx)(_FindReplaceToolbarButtonWithState.default, {
73
74
  popupsBoundariesElement: props.popupsBoundariesElement,
74
75
  popupsMountPoint: props.popupsMountPoint,
@@ -77,7 +78,7 @@ var EditorToolbar = exports.EditorToolbar = /*#__PURE__*/_react.default.memo(fun
77
78
  containerElement: props.containerElement,
78
79
  dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
79
80
  featureFlags: props.featureFlags,
80
- editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions
81
+ editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics2 = editorAPI.analytics) === null || _editorAPI$analytics2 === void 0 ? void 0 : _editorAPI$analytics2.actions
81
82
  }) : null, !!props.customPrimaryToolbarComponents && 'after' in props.customPrimaryToolbarComponents ? props.customPrimaryToolbarComponents.after : props.customPrimaryToolbarComponents);
82
83
  (0, _react.useEffect)(function () {
83
84
  if (twoLineEditorToolbar) {
@@ -21,10 +21,10 @@ var _media = require("./media");
21
21
  var _layout = require("./layout");
22
22
  var _panel = require("./panel");
23
23
  var _styles5 = require("@atlaskit/editor-plugin-placeholder-text/styles");
24
- var _styles6 = require("../../plugins/extension/ui/styles");
24
+ var _extension = require("./extension");
25
25
  var _expand = require("./expand");
26
- var _styles7 = require("../../plugins/find-replace/styles");
27
- var _styles8 = require("../../plugins/tasks-and-decisions/styles");
26
+ var _styles6 = require("../../plugins/find-replace/styles");
27
+ var _styles7 = require("../../plugins/tasks-and-decisions/styles");
28
28
  var _status = require("./status");
29
29
  var _date = require("./date");
30
30
  var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
@@ -47,7 +47,7 @@ var placeholderStyles = exports.placeholderStyles = (0, _react2.css)(_templateOb
47
47
  var contentStyles = function contentStyles(props) {
48
48
  return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
49
49
  theme: props.theme
50
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _layout.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _panel.panelStyles)(props), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles6.extensionStyles, (0, _expand.expandStyles)(props), _styles7.findReplaceStyles, _styles4.textHighlightStyle, _styles8.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
50
+ }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _layout.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _panel.panelStyles)(props), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _extension.extensionStyles, (0, _expand.expandStyles)(props), _styles6.findReplaceStyles, _styles4.textHighlightStyle, _styles7.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
51
51
  };
52
52
  var createEditorContentStyle = exports.createEditorContentStyle = function createEditorContentStyle(styles) {
53
53
  return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
@@ -31,7 +31,7 @@ var _eventDispatcher = require("../../event-dispatcher");
31
31
  var _feedbackDialog = require("../../plugins/feedback-dialog");
32
32
  var _deprecationWarnings = _interopRequireDefault(require("../../utils/deprecation-warnings"));
33
33
  var _pickBy = _interopRequireDefault(require("../../utils/pick-by"));
34
- var _consts = require("../../plugins/analytics/consts");
34
+ var _utils = require("@atlaskit/editor-common/utils");
35
35
  var _context2 = require("../../presets/context");
36
36
  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; }
37
37
  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; }
@@ -130,7 +130,7 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
130
130
  })));
131
131
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openFeedbackPopup", function () {
132
132
  var dispatch = (0, _eventDispatcher.createDispatch)(_this.context.editorActions.eventDispatcher);
133
- dispatch(_consts.analyticsEventKey, {
133
+ dispatch(_utils.analyticsEventKey, {
134
134
  payload: {
135
135
  action: _analytics.ACTION.CLICKED,
136
136
  actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
@@ -16,7 +16,7 @@ var _react = _interopRequireDefault(require("react"));
16
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
  var _analytics = require("@atlaskit/editor-common/analytics");
18
18
  var _eventDispatcher = require("../../event-dispatcher");
19
- var _consts = require("../../plugins/analytics/consts");
19
+ var _utils = require("@atlaskit/editor-common/utils");
20
20
  var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
21
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); }; }
22
22
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -33,7 +33,7 @@ var WithHelpTrigger = exports.default = /*#__PURE__*/function (_React$Component)
33
33
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openHelp", function () {
34
34
  var editorActions = _this.context.editorActions;
35
35
  var dispatch = (0, _eventDispatcher.createDispatch)(editorActions.eventDispatcher);
36
- dispatch(_consts.analyticsEventKey, {
36
+ dispatch(_utils.analyticsEventKey, {
37
37
  payload: {
38
38
  action: _analytics.ACTION.CLICKED,
39
39
  actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
@@ -3,35 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.findNodePosByLocalIds = exports.findNodePosByFragmentLocalIds = void 0;
7
- var findNodePosByLocalIds = exports.findNodePosByLocalIds = function findNodePosByLocalIds(state, ids) {
8
- var _state$doc$attrs;
9
- var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10
- if (ids.length === 0) {
11
- return [];
12
- }
13
- var nodes = [];
14
- var localIdSet = new Set(ids);
15
- if (option.includeDocNode && localIdSet.has((_state$doc$attrs = state.doc.attrs) === null || _state$doc$attrs === void 0 ? void 0 : _state$doc$attrs.localId)) {
16
- nodes.push({
17
- node: state.doc,
18
- pos: 0
19
- });
20
- }
21
- state.doc.descendants(function (node, pos) {
22
- var _node$attrs;
23
- if (localIdSet.has((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId)) {
24
- nodes.push({
25
- node: node,
26
- pos: pos
27
- });
28
- }
29
-
30
- // stop traversing once we found all the nodes
31
- return localIdSet.size !== nodes.length;
32
- });
33
- return nodes;
34
- };
6
+ exports.findNodePosByFragmentLocalIds = void 0;
35
7
  var findNodePosByFragmentLocalIds = exports.findNodePosByFragmentLocalIds = function findNodePosByFragmentLocalIds(state, ids) {
36
8
  if (ids.length === 0) {
37
9
  return [];
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isValidPosition = exports.duplicateSelection = void 0;
6
+ exports.isValidPosition = void 0;
7
7
  Object.defineProperty(exports, "setAllSelection", {
8
8
  enumerable: true,
9
9
  get: function get() {
@@ -28,9 +28,6 @@ Object.defineProperty(exports, "setTextSelection", {
28
28
  return _utils.setTextSelection;
29
29
  }
30
30
  });
31
- var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
32
- var _state = require("@atlaskit/editor-prosemirror/state");
33
- var _selection = require("@atlaskit/editor-common/selection");
34
31
  var _utils = require("@atlaskit/editor-common/utils");
35
32
  // checks if the given position is within the ProseMirror document
36
33
  var isValidPosition = exports.isValidPosition = function isValidPosition(pos, state) {
@@ -38,15 +35,4 @@ var isValidPosition = exports.isValidPosition = function isValidPosition(pos, st
38
35
  return true;
39
36
  }
40
37
  return false;
41
- };
42
- var duplicateSelection = exports.duplicateSelection = function duplicateSelection(selectionToDuplicate, doc) {
43
- if (selectionToDuplicate instanceof _state.NodeSelection) {
44
- return _state.NodeSelection.create(doc, selectionToDuplicate.from);
45
- } else if (selectionToDuplicate instanceof _state.TextSelection) {
46
- return _state.TextSelection.create(doc, selectionToDuplicate.from, selectionToDuplicate.to);
47
- } else if (selectionToDuplicate instanceof _selection.GapCursorSelection) {
48
- return new _selection.GapCursorSelection(doc.resolve(selectionToDuplicate.from), selectionToDuplicate.side);
49
- } else if (selectionToDuplicate instanceof _cellSelection.CellSelection) {
50
- return new _cellSelection.CellSelection(doc.resolve(selectionToDuplicate.$anchorCell.pos), doc.resolve(selectionToDuplicate.$headCell.pos));
51
- }
52
38
  };
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.3.18";
8
+ var version = exports.version = "189.3.20";
@@ -2,10 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Node } from '@atlaskit/editor-prosemirror/model';
3
3
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
5
- import { analyticsEventKey, isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
5
+ import { analyticsEventKey, isEmptyDocument, processRawValue, findNodePosByLocalIds } from '@atlaskit/editor-common/utils';
6
6
  import { createDispatch } from '../event-dispatcher';
7
7
  import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
8
- import { findNodePosWithLocalId } from '../plugins/extension/utils';
9
8
  import { toJSON } from '../utils';
10
9
  import { __temporaryFixForConfigPanel, getEditorValueWithMedia } from '../utils/action';
11
10
  import deprecationWarnings from '../utils/deprecation-warnings';
@@ -165,8 +164,10 @@ export default class EditorActions {
165
164
  getNodeByLocalId(id) {
166
165
  var _this$editorView;
167
166
  if ((_this$editorView = this.editorView) !== null && _this$editorView !== void 0 && _this$editorView.state) {
168
- var _findNodePosWithLocal, _this$editorView2;
169
- return (_findNodePosWithLocal = findNodePosWithLocalId((_this$editorView2 = this.editorView) === null || _this$editorView2 === void 0 ? void 0 : _this$editorView2.state, id)) === null || _findNodePosWithLocal === void 0 ? void 0 : _findNodePosWithLocal.node;
167
+ var _this$editorView2;
168
+ const nodes = findNodePosByLocalIds((_this$editorView2 = this.editorView) === null || _this$editorView2 === void 0 ? void 0 : _this$editorView2.state, [id]);
169
+ const node = nodes.length >= 1 ? nodes[0] : undefined;
170
+ return node === null || node === void 0 ? void 0 : node.node;
170
171
  }
171
172
  }
172
173
  getNodeByFragmentLocalId(id) {
@@ -18,13 +18,15 @@ const avatarGroup = ({
18
18
  eventDispatcher,
19
19
  dispatchAnalyticsEvent
20
20
  }) {
21
+ var _api$analytics;
21
22
  return /*#__PURE__*/React.createElement(AvatarGroupPluginWrapper, {
22
23
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
23
24
  editorView: editorView,
24
25
  eventDispatcher: eventDispatcher,
25
26
  collabEdit: props === null || props === void 0 ? void 0 : props.collabEdit,
26
27
  takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
27
- featureFlags: featureFlags
28
+ featureFlags: featureFlags,
29
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
28
30
  });
29
31
  }
30
32
  };
@@ -45,7 +45,8 @@ const AvatarGroupPluginWrapper = props => {
45
45
  inviteToEditComponent: props.collabEdit && props.collabEdit.inviteToEditComponent,
46
46
  inviteToEditHandler: props.collabEdit && props.collabEdit.inviteToEditHandler,
47
47
  isInviteToEditButtonSelected: props.collabEdit && props.collabEdit.isInviteToEditButtonSelected,
48
- featureFlags: featureFlags
48
+ featureFlags: featureFlags,
49
+ editorAnalyticsAPI: props.editorAnalyticsAPI
49
50
  }));
50
51
  };
51
52
  export default AvatarGroupPluginWrapper;
@@ -4,7 +4,7 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import CodeBidiWarning from '@atlaskit/code/bidi-warning';
5
5
  import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
6
6
  import { pluginFactory } from '../../../utils/plugin-state-factory';
7
- import { stepHasSlice } from '../../../utils/step';
7
+ import { stepHasSlice } from '@atlaskit/editor-common/utils';
8
8
  import { codeBidiWarningPluginKey } from '../plugin-key';
9
9
  import reducer from './reducer';
10
10
  export const {
@@ -12,7 +12,8 @@ const AvatarsWithPluginState = props => {
12
12
  inviteToEditHandler: onClick,
13
13
  inviteToEditComponent: Component,
14
14
  editorView,
15
- featureFlags
15
+ featureFlags,
16
+ editorAnalyticsAPI
16
17
  } = props;
17
18
  const render = React.useCallback(({
18
19
  data
@@ -24,14 +25,15 @@ const AvatarsWithPluginState = props => {
24
25
  sessionId: data.sessionId,
25
26
  participants: data.activeParticipants,
26
27
  editorView: editorView,
27
- featureFlags: featureFlags
28
+ featureFlags: featureFlags,
29
+ editorAnalyticsAPI: editorAnalyticsAPI
28
30
  }, /*#__PURE__*/React.createElement(InviteToEditButton, {
29
31
  title: title,
30
32
  selected: selected,
31
33
  onClick: onClick,
32
34
  Component: Component
33
35
  }));
34
- }, [selected, onClick, Component, title, editorView, featureFlags]);
36
+ }, [selected, onClick, Component, title, editorView, featureFlags, editorAnalyticsAPI]);
35
37
  return /*#__PURE__*/React.createElement(WithPluginState, {
36
38
  plugins: {
37
39
  data: collabEditPluginKey
@@ -31,7 +31,7 @@ export const Avatars = /*#__PURE__*/React.memo(props => {
31
31
 
32
32
  // user does not need to scroll to their own position (index 0)
33
33
  if (allowCollabAvatarScroll && index > 0) {
34
- scrollToCollabCursor(editorView, participants, props.sessionId, index);
34
+ scrollToCollabCursor(editorView, participants, props.sessionId, index, props.editorAnalyticsAPI);
35
35
  }
36
36
  }
37
37
  }), props.children);
@@ -3,7 +3,6 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
3
  import * as themeColors from '@atlaskit/theme/colors';
4
4
  import { hexToRgba } from '@atlaskit/adf-schema';
5
5
  import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
6
- import { addAnalytics } from '../analytics/utils';
7
6
  import { EVENT_TYPE, ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
8
7
  // TODO: https://product-fabric.atlassian.net/browse/DSP-7269
9
8
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
@@ -110,7 +109,7 @@ export const replaceDocument = (doc, state, version, options, reserveCursor) =>
110
109
  }
111
110
  return tr;
112
111
  };
113
- export const scrollToCollabCursor = (editorView, participants, sessionId, index) => {
112
+ export const scrollToCollabCursor = (editorView, participants, sessionId, index, editorAnalyticsAPI) => {
114
113
  const selectedUser = participants[index];
115
114
  if (selectedUser && selectedUser.cursorPos !== undefined && selectedUser.sessionId !== sessionId) {
116
115
  const {
@@ -123,7 +122,7 @@ export const scrollToCollabCursor = (editorView, participants, sessionId, index)
123
122
  eventType: EVENT_TYPE.TRACK
124
123
  };
125
124
  tr.setSelection(Selection.near(tr.doc.resolve(selectedUser.cursorPos)));
126
- tr = addAnalytics(state, tr, analyticsPayload);
125
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(analyticsPayload)(tr);
127
126
  tr.scrollIntoView();
128
127
  editorView.dispatch(tr);
129
128
  if (!editorView.hasFocus()) {
@@ -1,8 +1,7 @@
1
1
  import { Selection, NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { replaceSelectedNode, findSelectedNodeOfType, replaceParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  export { transformSliceToRemoveOpenBodiedExtension } from '@atlaskit/editor-common/transforms';
4
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
- import { TARGET_SELECTION_SOURCE } from '../analytics/types/extension-events';
4
+ import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
6
5
  import { findExtensionWithLocalId } from './utils';
7
6
  import { getPluginState } from './pm-plugins/main';
8
7
  import { getEditInLegacyMacroBrowser, createExtensionAPI } from './extension-api';
@@ -2,12 +2,13 @@ import React from 'react';
2
2
  import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
3
3
  import { getPluginState } from './pm-plugins/main';
4
4
  import { getSelectedExtension } from './utils';
5
- import WithEditorActions from '../../ui/WithEditorActions';
6
5
  import ConfigPanelLoader from '../../ui/ConfigPanel/ConfigPanelLoader';
7
- import { duplicateSelection } from '../../utils/selection';
8
6
  import { clearEditingContext, forceAutoSave, updateState } from './commands';
9
7
  import { buildExtensionNode } from './actions';
10
8
  import { SaveIndicator } from './ui/SaveIndicator/SaveIndicator';
9
+ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
10
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
11
+ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
11
12
  const areParametersEqual = (firstParameters, secondParameters) => {
12
13
  if (typeof firstParameters === 'object' && typeof secondParameters === 'object' && firstParameters !== null && secondParameters !== null) {
13
14
  const firstKeys = Object.keys(firstParameters);
@@ -16,7 +17,18 @@ const areParametersEqual = (firstParameters, secondParameters) => {
16
17
  }
17
18
  return firstParameters === secondParameters;
18
19
  };
19
- export const getContextPanel = (allowAutoSave, featureFlags, applyChange) => state => {
20
+ export const duplicateSelection = (selectionToDuplicate, doc) => {
21
+ if (selectionToDuplicate instanceof NodeSelection) {
22
+ return NodeSelection.create(doc, selectionToDuplicate.from);
23
+ } else if (selectionToDuplicate instanceof TextSelection) {
24
+ return TextSelection.create(doc, selectionToDuplicate.from, selectionToDuplicate.to);
25
+ } else if (selectionToDuplicate instanceof GapCursorSelection) {
26
+ return new GapCursorSelection(doc.resolve(selectionToDuplicate.from), selectionToDuplicate.side);
27
+ } else if (selectionToDuplicate instanceof CellSelection) {
28
+ return new CellSelection(doc.resolve(selectionToDuplicate.$anchorCell.pos), doc.resolve(selectionToDuplicate.$headCell.pos));
29
+ }
30
+ };
31
+ export const getContextPanel = getEditorView => (allowAutoSave, featureFlags, applyChange) => state => {
20
32
  const nodeWithPos = getSelectedExtension(state, true);
21
33
 
22
34
  // Adding checks to bail out early
@@ -47,51 +59,47 @@ export const getContextPanel = (allowAutoSave, featureFlags, applyChange) => sta
47
59
  onSaveStarted,
48
60
  onSaveEnded
49
61
  }) => {
50
- return /*#__PURE__*/React.createElement(WithEditorActions, {
51
- render: actions => {
52
- const editorView = actions._privateGetEditorView();
53
- if (!editorView) {
54
- return null;
62
+ const editorView = getEditorView === null || getEditorView === void 0 ? void 0 : getEditorView();
63
+ if (!editorView) {
64
+ return null;
65
+ }
66
+ return /*#__PURE__*/React.createElement(ConfigPanelLoader, {
67
+ showHeader: true,
68
+ closeOnEsc: true,
69
+ extensionType: extensionType,
70
+ extensionKey: extKey,
71
+ nodeKey: nodeKey,
72
+ extensionParameters: parameters,
73
+ parameters: configParams,
74
+ extensionProvider: extensionProvider,
75
+ autoSave: allowAutoSave,
76
+ autoSaveTrigger: autoSaveResolve,
77
+ autoSaveReject: autoSaveReject,
78
+ onChange: async updatedParameters => {
79
+ await onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
80
+ onSaveEnded();
81
+ if (autoSaveResolve) {
82
+ autoSaveResolve();
83
+ }
84
+ if (!allowAutoSave) {
85
+ clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
86
+ }
87
+ },
88
+ onCancel: async () => {
89
+ if (allowAutoSave) {
90
+ try {
91
+ await new Promise((resolve, reject) => {
92
+ forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
93
+ });
94
+ } catch (e) {
95
+ // Even if the save failed, we should proceed with closing the panel
96
+ // eslint-disable-next-line no-console
97
+ console.error(`Autosave failed with error`, e);
98
+ }
55
99
  }
56
- return /*#__PURE__*/React.createElement(ConfigPanelLoader, {
57
- showHeader: true,
58
- closeOnEsc: true,
59
- extensionType: extensionType,
60
- extensionKey: extKey,
61
- nodeKey: nodeKey,
62
- extensionParameters: parameters,
63
- parameters: configParams,
64
- extensionProvider: extensionProvider,
65
- autoSave: allowAutoSave,
66
- autoSaveTrigger: autoSaveResolve,
67
- autoSaveReject: autoSaveReject,
68
- onChange: async updatedParameters => {
69
- await onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
70
- onSaveEnded();
71
- if (autoSaveResolve) {
72
- autoSaveResolve();
73
- }
74
- if (!allowAutoSave) {
75
- clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
76
- }
77
- },
78
- onCancel: async () => {
79
- if (allowAutoSave) {
80
- try {
81
- await new Promise((resolve, reject) => {
82
- forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
83
- });
84
- } catch (e) {
85
- // Even if the save failed, we should proceed with closing the panel
86
- // eslint-disable-next-line no-console
87
- console.error(`Autosave failed with error`, e);
88
- }
89
- }
90
- clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
91
- },
92
- featureFlags: featureFlags
93
- });
94
- }
100
+ clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
101
+ },
102
+ featureFlags: featureFlags
95
103
  });
96
104
  });
97
105
  }
@@ -4,7 +4,7 @@ import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
4
4
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { insertMacroFromMacroBrowser } from './pm-plugins/macro/actions';
6
6
  import { pluginKey as macroPluginKey } from './pm-plugins/macro/plugin-key';
7
- import { nodeToJSON } from '../../utils';
7
+ import { nodeToJSON } from '@atlaskit/editor-common/utils';
8
8
  import { setEditingContextToContextPanel } from './commands';
9
9
  import { findNodePosWithLocalId, getDataConsumerMark, getNodeTypesReferenced, getSelectedExtension } from './utils';
10
10
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -97,7 +97,10 @@ const extensionPlugin = ({
97
97
  applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange,
98
98
  editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions
99
99
  }),
100
- contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$contextPanel4 = api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
100
+ contextPanel: getContextPanel(() => {
101
+ var _editorViewRef$curren;
102
+ return (_editorViewRef$curren = editorViewRef.current) !== null && _editorViewRef$curren !== void 0 ? _editorViewRef$curren : undefined;
103
+ })(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$contextPanel4 = api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
101
104
  }
102
105
  };
103
106
  };
@@ -1,4 +1,4 @@
1
- import { pluginFactory } from '../../utils/plugin-state-factory';
1
+ import { pluginFactory } from '@atlaskit/editor-common/utils';
2
2
  import reducer from './reducer';
3
3
  import { pluginKey } from './plugin-key';
4
4
  const factory = pluginFactory(pluginKey, reducer, {
@@ -4,8 +4,7 @@ import { safeInsert, replaceSelectedNode, findSelectedNodeOfType, replaceParentN
4
4
  import { getValidNode } from '@atlaskit/editor-common/validator';
5
5
  import { normaliseNestedLayout } from '@atlaskit/editor-common/insert';
6
6
  import { getPluginState as getExtensionPluginState } from '../../plugin-factory';
7
- import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
- import { TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
7
+ import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
9
8
  import { pluginKey } from './plugin-key';
10
9
  export const insertMacroFromMacroBrowser = editorAnalyticsAPI => (macroProvider, macroNode, isEditing) => async view => {
11
10
  if (!macroProvider) {
@@ -1,7 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { uuid } from '@atlaskit/adf-schema';
4
- import { stepAddsOneOf } from '../../../utils/step';
4
+ import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
5
5
  const pluginKey = new PluginKey('extensionUniqueIdPlugin');
6
6
  const createPlugin = () => new SafePlugin({
7
7
  // TODO: @see ED-8839
@@ -5,7 +5,7 @@ import EditIcon from '@atlaskit/icon/glyph/editor/edit';
5
5
  import FullWidthIcon from '@atlaskit/icon/glyph/editor/media-full-width';
6
6
  import WideIcon from '@atlaskit/icon/glyph/editor/media-wide';
7
7
  import CenterIcon from '@atlaskit/icon/glyph/editor/media-center';
8
- import commonMessages from '../../messages';
8
+ import commonMessages from '@atlaskit/editor-common/messages';
9
9
  import { editExtension } from './actions';
10
10
  import { getPluginState } from './pm-plugins/main';
11
11
  import { getSelectedExtension } from './utils';
@@ -1,6 +1,5 @@
1
1
  import { findParentNodeOfType, findSelectedNodeOfType, findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
2
- import { closestElement } from '../../utils/dom';
3
- import { findNodePosByLocalIds } from '../../utils/nodes-by-localIds';
2
+ import { findNodePosByLocalIds, closestElement } from '@atlaskit/editor-common/utils';
4
3
  export const getSelectedExtension = (state, searchParent = false) => {
5
4
  const {
6
5
  inlineExtension,
@@ -5,7 +5,7 @@ import reducer from './reducer';
5
5
  import { findReplacePluginKey } from './types';
6
6
  import { findMatches, createDecorations, removeDecorationsFromSet, findSearchIndex, removeMatchesFromSet, findDecorationFromMatch, isMatchAffectedByStep } from './utils';
7
7
  import { findUniqueItemsIn } from '../../utils/array';
8
- import { stepHasSlice } from '../../utils/step';
8
+ import { stepHasSlice } from '@atlaskit/editor-common/utils';
9
9
  export const initialState = {
10
10
  isActive: false,
11
11
  shouldFocus: false,
@@ -11,7 +11,6 @@ export { default as alignmentPlugin } from './alignment';
11
11
  export { default as dataConsumerMarkPlugin } from './data-consumer';
12
12
  export { default as indentationPlugin } from './indentation';
13
13
  export { default as annotationPlugin } from './annotation';
14
- export { default as analyticsPlugin } from './analytics';
15
14
  export { default as customAutoformatPlugin } from './custom-autoformat';
16
15
  export { default as feedbackDialogPlugin } from './feedback-dialog';
17
16
  export { default as mobileDimensionsPlugin } from './mobile-dimensions';
@@ -17,7 +17,6 @@ import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
17
17
  import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
18
18
  import { floatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
19
19
  import { clipboardPlugin } from '@atlaskit/editor-plugin-clipboard';
20
- import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../plugins';
21
20
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
22
21
  import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
23
22
  import annotationPlugin from '../plugins/annotation';
@@ -49,18 +48,6 @@ export function createDefaultPreset(options) {
49
48
  }]);
50
49
  }
51
50
  return builder;
52
- }).maybeAdd(deprecatedAnalyticsPlugin, (plugin, builder) => {
53
- if (options.allowAnalyticsGASV3) {
54
- const {
55
- performanceTracking,
56
- createAnalyticsEvent
57
- } = options;
58
- return builder.add([plugin, {
59
- createAnalyticsEvent,
60
- performanceTracking
61
- }]);
62
- }
63
- return builder;
64
51
  }).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([basePlugin, options.base]).add(decorationsPlugin).maybeAdd(undoRedoPlugin, (p, builder) => {
65
52
  var _options$featureFlags;
66
53
  // The undo redo plugin needs to be add before the blockTypePlugin