@atlaskit/editor-core 189.1.0 → 189.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/extensibility.js +4 -4
  3. package/dist/cjs/plugins/annotation/commands/index.js +51 -43
  4. package/dist/cjs/plugins/annotation/commands/transform.js +43 -33
  5. package/dist/cjs/plugins/annotation/index.js +12 -5
  6. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +17 -13
  7. package/dist/cjs/plugins/annotation/pm-plugins/keymap.js +2 -2
  8. package/dist/cjs/plugins/annotation/toolbar.js +41 -39
  9. package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +4 -3
  10. package/dist/cjs/plugins/index.js +0 -7
  11. package/dist/cjs/presets/universal.js +2 -1
  12. package/dist/cjs/utils/document.js +0 -26
  13. package/dist/cjs/version-wrapper.js +1 -1
  14. package/dist/es2019/extensibility.js +1 -1
  15. package/dist/es2019/plugins/annotation/commands/index.js +8 -8
  16. package/dist/es2019/plugins/annotation/commands/transform.js +13 -11
  17. package/dist/es2019/plugins/annotation/index.js +12 -5
  18. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +10 -10
  19. package/dist/es2019/plugins/annotation/pm-plugins/keymap.js +2 -2
  20. package/dist/es2019/plugins/annotation/toolbar.js +2 -2
  21. package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +4 -3
  22. package/dist/es2019/plugins/index.js +0 -1
  23. package/dist/es2019/presets/universal.js +3 -2
  24. package/dist/es2019/utils/document.js +0 -25
  25. package/dist/es2019/version-wrapper.js +1 -1
  26. package/dist/esm/extensibility.js +1 -1
  27. package/dist/esm/plugins/annotation/commands/index.js +51 -43
  28. package/dist/esm/plugins/annotation/commands/transform.js +40 -30
  29. package/dist/esm/plugins/annotation/index.js +12 -5
  30. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +17 -13
  31. package/dist/esm/plugins/annotation/pm-plugins/keymap.js +2 -2
  32. package/dist/esm/plugins/annotation/toolbar.js +41 -39
  33. package/dist/esm/plugins/annotation/ui/InlineCommentView.js +4 -3
  34. package/dist/esm/plugins/index.js +0 -1
  35. package/dist/esm/presets/universal.js +3 -2
  36. package/dist/esm/utils/document.js +0 -24
  37. package/dist/esm/version-wrapper.js +1 -1
  38. package/dist/types/extensibility.d.ts +1 -1
  39. package/dist/types/plugins/annotation/commands/index.d.ts +5 -4
  40. package/dist/types/plugins/annotation/commands/transform.d.ts +5 -4
  41. package/dist/types/plugins/annotation/index.d.ts +5 -2
  42. package/dist/types/plugins/annotation/pm-plugins/keymap.d.ts +2 -1
  43. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -0
  44. package/dist/types/plugins/annotation/toolbar.d.ts +2 -1
  45. package/dist/types/plugins/annotation/ui/InlineCommentView.d.ts +3 -1
  46. package/dist/types/plugins/index.d.ts +0 -1
  47. package/dist/types/utils/document.d.ts +0 -11
  48. package/dist/types-ts4.5/extensibility.d.ts +1 -1
  49. package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +5 -4
  50. package/dist/types-ts4.5/plugins/annotation/commands/transform.d.ts +5 -4
  51. package/dist/types-ts4.5/plugins/annotation/index.d.ts +7 -2
  52. package/dist/types-ts4.5/plugins/annotation/pm-plugins/keymap.d.ts +2 -1
  53. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -0
  54. package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +2 -1
  55. package/dist/types-ts4.5/plugins/annotation/ui/InlineCommentView.d.ts +3 -1
  56. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  57. package/dist/types-ts4.5/utils/document.d.ts +0 -11
  58. package/package.json +4 -3
  59. package/dist/cjs/plugins/fragment/index.js +0 -29
  60. package/dist/cjs/plugins/fragment/plugin-key.js +0 -8
  61. package/dist/cjs/plugins/fragment/pm-plugins/fragment-consistency.js +0 -143
  62. package/dist/es2019/plugins/fragment/index.js +0 -20
  63. package/dist/es2019/plugins/fragment/plugin-key.js +0 -2
  64. package/dist/es2019/plugins/fragment/pm-plugins/fragment-consistency.js +0 -113
  65. package/dist/esm/plugins/fragment/index.js +0 -23
  66. package/dist/esm/plugins/fragment/plugin-key.js +0 -2
  67. package/dist/esm/plugins/fragment/pm-plugins/fragment-consistency.js +0 -137
  68. package/dist/types/plugins/fragment/index.d.ts +0 -3
  69. package/dist/types/plugins/fragment/plugin-key.d.ts +0 -2
  70. package/dist/types/plugins/fragment/pm-plugins/fragment-consistency.d.ts +0 -15
  71. package/dist/types-ts4.5/plugins/fragment/index.d.ts +0 -3
  72. package/dist/types-ts4.5/plugins/fragment/plugin-key.d.ts +0 -2
  73. package/dist/types-ts4.5/plugins/fragment/pm-plugins/fragment-consistency.d.ts +0 -15
@@ -33,11 +33,13 @@ var annotationPlugin = function annotationPlugin(_ref) {
33
33
  portalProviderAPI = _ref2.portalProviderAPI,
34
34
  eventDispatcher = _ref2.eventDispatcher;
35
35
  if (annotationProviders) {
36
+ var _api$analytics;
36
37
  return inlineCommentPlugin({
37
38
  dispatch: dispatch,
38
39
  portalProviderAPI: portalProviderAPI,
39
40
  eventDispatcher: eventDispatcher,
40
- provider: annotationProviders.inlineComment
41
+ provider: annotationProviders.inlineComment,
42
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
41
43
  });
42
44
  }
43
45
  return;
@@ -46,7 +48,8 @@ var annotationPlugin = function annotationPlugin(_ref) {
46
48
  name: 'annotationKeymap',
47
49
  plugin: function plugin() {
48
50
  if (annotationProviders) {
49
- return keymapPlugin();
51
+ var _api$analytics2;
52
+ return keymapPlugin(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
50
53
  }
51
54
  return;
52
55
  }
@@ -59,8 +62,9 @@ var annotationPlugin = function annotationPlugin(_ref) {
59
62
  }
60
63
  var pluginState = getPluginState(state);
61
64
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
65
+ var _api$analytics3;
62
66
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
63
- return buildToolbar(state, intl, isToolbarAbove);
67
+ return buildToolbar(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, intl, isToolbarAbove);
64
68
  }
65
69
  },
66
70
  selectionToolbar: function selectionToolbar(state, intl) {
@@ -69,8 +73,9 @@ var annotationPlugin = function annotationPlugin(_ref) {
69
73
  }
70
74
  var pluginState = getPluginState(state);
71
75
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
76
+ var _api$analytics4;
72
77
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
73
- return buildToolbar(state, intl, isToolbarAbove);
78
+ return buildToolbar(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove);
74
79
  }
75
80
  }
76
81
  },
@@ -90,6 +95,7 @@ var annotationPlugin = function annotationPlugin(_ref) {
90
95
  };
91
96
  };
92
97
  function AnnotationContentComponent(_ref4) {
98
+ var _api$analytics5;
93
99
  var api = _ref4.api,
94
100
  editorView = _ref4.editorView,
95
101
  annotationProviders = _ref4.annotationProviders,
@@ -104,7 +110,8 @@ function AnnotationContentComponent(_ref4) {
104
110
  }, /*#__PURE__*/React.createElement(InlineCommentView, {
105
111
  providers: annotationProviders,
106
112
  editorView: editorView,
107
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
113
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
114
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
108
115
  }));
109
116
  }
110
117
  export default annotationPlugin;
@@ -40,7 +40,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
40
40
  // fetchState is unable to return a command as it's runs async and may dispatch at a later time
41
41
  // Requires `editorView` instead of the decomposition as the async means state may end up stale
42
42
  var fetchState = /*#__PURE__*/function () {
43
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(provider, annotationIds, editorView) {
43
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(provider, annotationIds, editorView, editorAnalyticsAPI) {
44
44
  var inlineCommentStates;
45
45
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
46
46
  while (1) switch (_context2.prev = _context2.next) {
@@ -56,7 +56,7 @@ var fetchState = /*#__PURE__*/function () {
56
56
  case 4:
57
57
  inlineCommentStates = _context2.sent;
58
58
  if (editorView.dispatch) {
59
- updateInlineCommentResolvedState(inlineCommentStates)(editorView.state, editorView.dispatch);
59
+ updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
60
60
  }
61
61
  case 6:
62
62
  case "end":
@@ -64,7 +64,7 @@ var fetchState = /*#__PURE__*/function () {
64
64
  }
65
65
  }, _callee2);
66
66
  }));
67
- return function fetchState(_x3, _x4, _x5) {
67
+ return function fetchState(_x3, _x4, _x5, _x6) {
68
68
  return _ref2.apply(this, arguments);
69
69
  };
70
70
  }();
@@ -90,14 +90,18 @@ var hideToolbar = function hideToolbar(state, dispatch) {
90
90
  };
91
91
 
92
92
  // Subscribe to updates from consumer
93
- var onResolve = function onResolve(state, dispatch) {
94
- return function (annotationId) {
95
- updateInlineCommentResolvedState(_defineProperty({}, annotationId, true), RESOLVE_METHOD.CONSUMER)(state, dispatch);
93
+ var onResolve = function onResolve(editorAnalyticsAPI) {
94
+ return function (state, dispatch) {
95
+ return function (annotationId) {
96
+ updateInlineCommentResolvedState(editorAnalyticsAPI)(_defineProperty({}, annotationId, true), RESOLVE_METHOD.CONSUMER)(state, dispatch);
97
+ };
96
98
  };
97
99
  };
98
- var onUnResolve = function onUnResolve(state, dispatch) {
99
- return function (annotationId) {
100
- updateInlineCommentResolvedState(_defineProperty({}, annotationId, false))(state, dispatch);
100
+ var onUnResolve = function onUnResolve(editorAnalyticsAPI) {
101
+ return function (state, dispatch) {
102
+ return function (annotationId) {
103
+ updateInlineCommentResolvedState(editorAnalyticsAPI)(_defineProperty({}, annotationId, false))(state, dispatch);
104
+ };
101
105
  };
102
106
  };
103
107
  var onMouseUp = function onMouseUp(state, dispatch) {
@@ -135,12 +139,12 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
135
139
  view: function view(editorView) {
136
140
  // Get initial state
137
141
  // Need to pass `editorView` to mitigate editor state going stale
138
- fetchState(provider, getAllAnnotations(editorView.state.doc), editorView);
142
+ fetchState(provider, getAllAnnotations(editorView.state.doc), editorView, options.editorAnalyticsAPI);
139
143
  var resolve = function resolve(annotationId) {
140
- return onResolve(editorView.state, editorView.dispatch)(annotationId);
144
+ return onResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
141
145
  };
142
146
  var unResolve = function unResolve(annotationId) {
143
- return onUnResolve(editorView.state, editorView.dispatch)(annotationId);
147
+ return onUnResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
144
148
  };
145
149
  var mouseUp = function mouseUp(event) {
146
150
  return onMouseUp(editorView.state, editorView.dispatch)(event);
@@ -168,7 +172,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
168
172
  return;
169
173
  }
170
174
  clearDirtyMark()(view.state, view.dispatch);
171
- fetchState(provider, getAllAnnotations(view.state.doc), view);
175
+ fetchState(provider, getAllAnnotations(view.state.doc), view, options.editorAnalyticsAPI);
172
176
  },
173
177
  destroy: function destroy() {
174
178
  editorView.root.removeEventListener('mouseup', mouseUp);
@@ -2,8 +2,8 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
2
  import { bindKeymapWithCommand, addInlineComment } from '../../../keymaps';
3
3
  import { setInlineCommentDraftState } from '../commands';
4
4
  import { INPUT_METHOD } from '../../analytics';
5
- export function keymapPlugin() {
5
+ export function keymapPlugin(editorAnalyticsAPI) {
6
6
  var list = {};
7
- bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(true, INPUT_METHOD.SHORTCUT), list);
7
+ bindKeymapWithCommand(addInlineComment.common, setInlineCommentDraftState(editorAnalyticsAPI)(true, INPUT_METHOD.SHORTCUT), list);
8
8
  return keymap(list);
9
9
  }
@@ -6,45 +6,47 @@ import { AnnotationTestIds, AnnotationSelectionType } from './types';
6
6
  import { isSelectionValid } from './utils';
7
7
  import { annotationMessages } from '@atlaskit/editor-common/messages';
8
8
  import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
9
- export var buildToolbar = function buildToolbar(state, intl) {
10
- var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
11
- var schema = state.schema;
12
- var selectionValid = isSelectionValid(state);
13
- if (selectionValid === AnnotationSelectionType.INVALID) {
14
- return undefined;
15
- }
16
- var createCommentMessage = intl.formatMessage(annotationMessages.createComment);
17
- var commentDisabledMessage = intl.formatMessage(annotationMessages.createCommentInvalid);
18
- var createComment = {
19
- type: 'button',
20
- showTitle: true,
21
- disabled: selectionValid === AnnotationSelectionType.DISABLED,
22
- testId: AnnotationTestIds.floatingToolbarCreateButton,
23
- icon: CommentIcon,
24
- tooltipContent: selectionValid === AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
25
- description: createCommentMessage,
26
- keymap: addInlineComment
27
- }),
28
- title: createCommentMessage,
29
- onClick: function onClick(state, dispatch) {
30
- return setInlineCommentDraftState(true)(state, dispatch);
9
+ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
10
+ return function (state, intl) {
11
+ var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12
+ var schema = state.schema;
13
+ var selectionValid = isSelectionValid(state);
14
+ if (selectionValid === AnnotationSelectionType.INVALID) {
15
+ return undefined;
31
16
  }
32
- };
33
- var annotation = schema.marks.annotation;
34
- var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
35
- var type = schema.nodes[current];
36
- if (type.allowsMarkType(annotation)) {
37
- acc.push(type);
38
- }
39
- return acc;
40
- }, []);
41
- var toolbarTitle = intl.formatMessage(annotationMessages.toolbar);
42
- var calcToolbarPosition = isToolbarAbove ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
43
- var onPositionCalculated = calcToolbarPosition(toolbarTitle);
44
- return {
45
- title: toolbarTitle,
46
- nodeType: validNodes,
47
- items: [createComment],
48
- onPositionCalculated: onPositionCalculated
17
+ var createCommentMessage = intl.formatMessage(annotationMessages.createComment);
18
+ var commentDisabledMessage = intl.formatMessage(annotationMessages.createCommentInvalid);
19
+ var createComment = {
20
+ type: 'button',
21
+ showTitle: true,
22
+ disabled: selectionValid === AnnotationSelectionType.DISABLED,
23
+ testId: AnnotationTestIds.floatingToolbarCreateButton,
24
+ icon: CommentIcon,
25
+ tooltipContent: selectionValid === AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
26
+ description: createCommentMessage,
27
+ keymap: addInlineComment
28
+ }),
29
+ title: createCommentMessage,
30
+ onClick: function onClick(state, dispatch) {
31
+ return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
32
+ }
33
+ };
34
+ var annotation = schema.marks.annotation;
35
+ var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
36
+ var type = schema.nodes[current];
37
+ if (type.allowsMarkType(annotation)) {
38
+ acc.push(type);
39
+ }
40
+ return acc;
41
+ }, []);
42
+ var toolbarTitle = intl.formatMessage(annotationMessages.toolbar);
43
+ var calcToolbarPosition = isToolbarAbove ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
44
+ var onPositionCalculated = calcToolbarPosition(toolbarTitle);
45
+ return {
46
+ title: toolbarTitle,
47
+ nodeType: validNodes,
48
+ items: [createComment],
49
+ onPositionCalculated: onPositionCalculated
50
+ };
49
51
  };
50
52
  };
@@ -27,6 +27,7 @@ var findPosForDOM = function findPosForDOM(sel) {
27
27
  export function InlineCommentView(_ref) {
28
28
  var providers = _ref.providers,
29
29
  editorView = _ref.editorView,
30
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI,
30
31
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
31
32
  // As inlineComment is the only annotation present, this function is not generic
32
33
  var inlineCommentProvider = providers.inlineComment;
@@ -86,11 +87,11 @@ export function InlineCommentView(_ref) {
86
87
  dom: dom,
87
88
  textSelection: textSelection,
88
89
  onCreate: function onCreate(id) {
89
- createAnnotation(id)(editorView.state, editorView.dispatch);
90
+ createAnnotation(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
90
91
  !editorView.hasFocus() && editorView.focus();
91
92
  },
92
93
  onClose: function onClose() {
93
- setInlineCommentDraftState(false)(editorView.state, editorView.dispatch);
94
+ setInlineCommentDraftState(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
94
95
  !editorView.hasFocus() && editorView.focus();
95
96
  }
96
97
  }));
@@ -135,7 +136,7 @@ export function InlineCommentView(_ref) {
135
136
  return removeInlineCommentNearSelection(id)(state, dispatch);
136
137
  },
137
138
  onResolve: function onResolve(id) {
138
- return updateInlineCommentResolvedState(_defineProperty({}, id, true), RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
139
+ return updateInlineCommentResolvedState(editorAnalyticsAPI)(_defineProperty({}, id, true), RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
139
140
  },
140
141
  onClose: function onClose() {
141
142
  closeComponent()(editorView.state, editorView.dispatch);
@@ -15,7 +15,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
15
15
  export { default as breakoutPlugin } from './breakout';
16
16
  export { default as alignmentPlugin } from './alignment';
17
17
  export { default as dataConsumerMarkPlugin } from './data-consumer';
18
- export { default as fragmentMarkPlugin } from './fragment';
19
18
  export { default as indentationPlugin } from './indentation';
20
19
  export { default as annotationPlugin } from './annotation';
21
20
  export { default as analyticsPlugin } from './analytics';
@@ -2,7 +2,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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; }
5
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, fragmentMarkPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
5
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, panelPlugin, placeholderTextPlugin, tasksAndDecisionsPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, expandPlugin, isExpandInsertionEnabled, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
6
6
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
7
7
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
8
8
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
@@ -12,6 +12,7 @@ import { borderPlugin } from '@atlaskit/editor-plugin-border';
12
12
  import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
13
13
  import { mediaPlugin } from '@atlaskit/editor-plugin-media';
14
14
  import { rulePlugin } from '@atlaskit/editor-plugin-rule';
15
+ import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
15
16
  import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
16
17
  import { pasteOptionsToolbarPlugin } from '@atlaskit/editor-plugin-paste-options-toolbar';
17
18
  import { listPlugin } from '@atlaskit/editor-plugin-list';
@@ -384,7 +385,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
384
385
  return builder.add(plugin);
385
386
  }
386
387
  return builder;
387
- }).maybeAdd(fragmentMarkPlugin, function (plugin, builder) {
388
+ }).maybeAdd(fragmentPlugin, function (plugin, builder) {
388
389
  if (props.allowFragmentMark) {
389
390
  return builder.add(plugin);
390
391
  }
@@ -17,30 +17,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
17
17
  }
18
18
  return Fragment.from(adfEntities);
19
19
  }
20
- export function getChangedNodesIn(_ref) {
21
- var tr = _ref.tr,
22
- doc = _ref.doc;
23
- var nodes = [];
24
- var stepRange = getStepRange(tr);
25
- if (!stepRange) {
26
- return nodes;
27
- }
28
- var from = Math.min(doc.nodeSize - 2, stepRange.from);
29
- var to = Math.min(doc.nodeSize - 2, stepRange.to);
30
- doc.nodesBetween(from, to, function (node, pos) {
31
- nodes.push({
32
- node: node,
33
- pos: pos
34
- });
35
- });
36
- return nodes;
37
- }
38
- export function getChangedNodes(tr) {
39
- return getChangedNodesIn({
40
- tr: tr,
41
- doc: tr.doc
42
- });
43
- }
44
20
  export function nodesBetweenChanged(tr, f, startPos) {
45
21
  var stepRange = getStepRange(tr);
46
22
  if (!stepRange) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.1.0";
2
+ export var version = "189.1.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,4 +1,4 @@
1
- export { getChangedNodes } from './utils/document';
1
+ export { getChangedNodes } from '@atlaskit/editor-common/utils';
2
2
  export { validateNodes } from './utils/nodes';
3
3
  export { toJSON } from './utils';
4
4
  export { default as Extension } from './plugins/extension/ui/Extension';
@@ -1,15 +1,16 @@
1
1
  import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command } from '../../../types';
3
4
  import { AnnotationTypes } from '@atlaskit/adf-schema';
4
5
  import { INPUT_METHOD } from '../../analytics';
5
6
  import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
6
- export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
+ export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
8
  export declare const closeComponent: () => Command;
8
9
  export declare const clearDirtyMark: () => Command;
9
10
  export declare const removeInlineCommentNearSelection: (id: string) => Command;
10
- export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
11
- export declare const addInlineComment: (id: string) => Command;
11
+ export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
12
+ export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
14
  export declare const setSelectedAnnotation: (id: string) => Command;
14
- export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
15
+ export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
16
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -1,11 +1,12 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import type { RESOLVE_METHOD } from '../../analytics/types/inline-comment-events';
4
5
  declare const _default: {
5
6
  addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
- addInlineComment: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
7
- addOpenCloseAnalytics: (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
8
- addInsertAnalytics: (transaction: Transaction, state: EditorState) => Transaction;
9
- addResolveAnalytics: (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
7
+ addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
8
+ addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
9
+ addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
10
+ addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
10
11
  };
11
12
  export default _default;
@@ -1,12 +1,15 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, AnnotationState, InlineCommentState, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider } from './types';
3
3
  import type { UpdateEvent } from './update-provider';
4
4
  import { AnnotationUpdateEmitter } from './update-provider';
5
5
  import type { InlineCommentPluginState } from './pm-plugins/types';
6
- declare const annotationPlugin: NextEditorPlugin<'annotation', {
6
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
+ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
7
8
  pluginConfiguration: AnnotationProviders | undefined;
8
9
  sharedState: InlineCommentPluginState | undefined;
10
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
9
11
  }>;
12
+ declare const annotationPlugin: AnnotationPlugin;
10
13
  export default annotationPlugin;
11
14
  export { AnnotationUpdateEmitter };
12
15
  export type { AnnotationProviders, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider, AnnotationInfo, AnnotationState, InlineCommentState, UpdateEvent, };
@@ -1,2 +1,3 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -1,6 +1,7 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
5
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
5
6
  import type { InlineCommentAnnotationProvider, AnnotationInfo } from '../types';
6
7
  export declare enum ACTIONS {
@@ -18,6 +19,7 @@ export interface InlineCommentPluginOptions {
18
19
  eventDispatcher: EventDispatcher;
19
20
  portalProviderAPI: PortalProviderAPI;
20
21
  provider: InlineCommentAnnotationProvider;
22
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
21
23
  }
22
24
  export interface InlineCommentMouseData {
23
25
  isSelecting: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
- export declare const buildToolbar: (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
4
  import type { AnnotationProviders } from '../types';
4
5
  import type { DispatchAnalyticsEvent } from '../../analytics/types';
5
6
  interface InlineCommentViewProps {
6
7
  providers: AnnotationProviders;
7
8
  editorView: EditorView;
9
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
8
10
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
9
11
  }
10
- export declare function InlineCommentView({ providers, editorView, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
12
+ export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
11
13
  export {};
@@ -15,7 +15,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
15
15
  export { default as breakoutPlugin } from './breakout';
16
16
  export { default as alignmentPlugin } from './alignment';
17
17
  export { default as dataConsumerMarkPlugin } from './data-consumer';
18
- export { default as fragmentMarkPlugin } from './fragment';
19
18
  export { default as indentationPlugin } from './indentation';
20
19
  export { default as annotationPlugin } from './annotation';
21
20
  export { default as analyticsPlugin } from './analytics';
@@ -8,17 +8,6 @@ import type { BreakoutMarkAttrs } from '@atlaskit/adf-schema';
8
8
  export { findFarthestParentNode, isInEmptyLine, } from '@atlaskit/editor-common/utils';
9
9
  export declare function processRawFragmentValue(schema: Schema, value?: ReplaceRawValue[], providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Fragment | undefined;
10
10
  export type ChangedFn = (node: Node, pos: number, parent: Node | null, index: number) => boolean | void;
11
- export declare function getChangedNodesIn({ tr, doc, }: {
12
- tr: ReadonlyTransaction | Transaction;
13
- doc: Node;
14
- }): {
15
- node: Node;
16
- pos: number;
17
- }[];
18
- export declare function getChangedNodes(tr: ReadonlyTransaction | Transaction): {
19
- node: Node;
20
- pos: number;
21
- }[];
22
11
  export declare function nodesBetweenChanged(tr: Transaction | ReadonlyTransaction, f: ChangedFn, startPos?: number): void;
23
12
  export declare function getNodesCount(node: Node): Record<string, number>;
24
13
  /**
@@ -1,4 +1,4 @@
1
- export { getChangedNodes } from './utils/document';
1
+ export { getChangedNodes } from '@atlaskit/editor-common/utils';
2
2
  export { validateNodes } from './utils/nodes';
3
3
  export { toJSON } from './utils';
4
4
  export { default as Extension } from './plugins/extension/ui/Extension';
@@ -1,15 +1,16 @@
1
1
  import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command } from '../../../types';
3
4
  import { AnnotationTypes } from '@atlaskit/adf-schema';
4
5
  import { INPUT_METHOD } from '../../analytics';
5
6
  import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
6
- export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
+ export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
8
  export declare const closeComponent: () => Command;
8
9
  export declare const clearDirtyMark: () => Command;
9
10
  export declare const removeInlineCommentNearSelection: (id: string) => Command;
10
- export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
11
- export declare const addInlineComment: (id: string) => Command;
11
+ export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
12
+ export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
13
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
14
  export declare const setSelectedAnnotation: (id: string) => Command;
14
- export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
15
+ export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
16
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -1,11 +1,12 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import type { RESOLVE_METHOD } from '../../analytics/types/inline-comment-events';
4
5
  declare const _default: {
5
6
  addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
- addInlineComment: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
7
- addOpenCloseAnalytics: (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
8
- addInsertAnalytics: (transaction: Transaction, state: EditorState) => Transaction;
9
- addResolveAnalytics: (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
7
+ addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
8
+ addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
9
+ addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
10
+ addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
10
11
  };
11
12
  export default _default;
@@ -1,12 +1,17 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, AnnotationState, InlineCommentState, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider } from './types';
3
3
  import type { UpdateEvent } from './update-provider';
4
4
  import { AnnotationUpdateEmitter } from './update-provider';
5
5
  import type { InlineCommentPluginState } from './pm-plugins/types';
6
- declare const annotationPlugin: NextEditorPlugin<'annotation', {
6
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
+ export type AnnotationPlugin = NextEditorPlugin<'annotation', {
7
8
  pluginConfiguration: AnnotationProviders | undefined;
8
9
  sharedState: InlineCommentPluginState | undefined;
10
+ dependencies: [
11
+ OptionalPlugin<AnalyticsPlugin>
12
+ ];
9
13
  }>;
14
+ declare const annotationPlugin: AnnotationPlugin;
10
15
  export default annotationPlugin;
11
16
  export { AnnotationUpdateEmitter };
12
17
  export type { AnnotationProviders, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider, AnnotationInfo, AnnotationState, InlineCommentState, UpdateEvent, };
@@ -1,2 +1,3 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -1,6 +1,7 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
5
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
5
6
  import type { InlineCommentAnnotationProvider, AnnotationInfo } from '../types';
6
7
  export declare enum ACTIONS {
@@ -18,6 +19,7 @@ export interface InlineCommentPluginOptions {
18
19
  eventDispatcher: EventDispatcher;
19
20
  portalProviderAPI: PortalProviderAPI;
20
21
  provider: InlineCommentAnnotationProvider;
22
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
21
23
  }
22
24
  export interface InlineCommentMouseData {
23
25
  isSelecting: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
- export declare const buildToolbar: (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
+ export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
4
  import type { AnnotationProviders } from '../types';
4
5
  import type { DispatchAnalyticsEvent } from '../../analytics/types';
5
6
  interface InlineCommentViewProps {
6
7
  providers: AnnotationProviders;
7
8
  editorView: EditorView;
9
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
8
10
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
9
11
  }
10
- export declare function InlineCommentView({ providers, editorView, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
12
+ export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
11
13
  export {};
@@ -15,7 +15,6 @@ export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
15
15
  export { default as breakoutPlugin } from './breakout';
16
16
  export { default as alignmentPlugin } from './alignment';
17
17
  export { default as dataConsumerMarkPlugin } from './data-consumer';
18
- export { default as fragmentMarkPlugin } from './fragment';
19
18
  export { default as indentationPlugin } from './indentation';
20
19
  export { default as annotationPlugin } from './annotation';
21
20
  export { default as analyticsPlugin } from './analytics';