@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#42279](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42279) [`f4fd8d16522`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f4fd8d16522) - ED-20556 Extract Fragment plugin
8
+ - [#42255](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42255) [`44cdc71165d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/44cdc71165d) - Decouple annotation plugin from deprecated analytics plugin.
9
+ - Updated dependencies
10
+
3
11
  ## 189.1.0
4
12
 
5
13
  ### Minor Changes
@@ -26,14 +26,14 @@ Object.defineProperty(exports, "ExtensionNodeWrapper", {
26
26
  Object.defineProperty(exports, "getChangedNodes", {
27
27
  enumerable: true,
28
28
  get: function get() {
29
- return _document.getChangedNodes;
29
+ return _utils.getChangedNodes;
30
30
  }
31
31
  });
32
32
  exports.tablePluginKey = void 0;
33
33
  Object.defineProperty(exports, "toJSON", {
34
34
  enumerable: true,
35
35
  get: function get() {
36
- return _utils.toJSON;
36
+ return _utils2.toJSON;
37
37
  }
38
38
  });
39
39
  Object.defineProperty(exports, "validateNodes", {
@@ -42,9 +42,9 @@ Object.defineProperty(exports, "validateNodes", {
42
42
  return _nodes.validateNodes;
43
43
  }
44
44
  });
45
- var _document = require("./utils/document");
45
+ var _utils = require("@atlaskit/editor-common/utils");
46
46
  var _nodes = require("./utils/nodes");
47
- var _utils = require("./utils");
47
+ var _utils2 = require("./utils");
48
48
  var _Extension = _interopRequireDefault(require("./plugins/extension/ui/Extension"));
49
49
  var _ExtensionNodeWrapper = _interopRequireDefault(require("./plugins/extension/ui/Extension/ExtensionNodeWrapper"));
50
50
  var _extension = require("./plugins/extension/nodeviews/extension");
@@ -13,18 +13,20 @@ var _utils = require("../utils");
13
13
  var _types = require("../pm-plugins/types");
14
14
  var _transform = _interopRequireDefault(require("./transform"));
15
15
  var _types2 = require("../types");
16
- var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(partialNewState, resolveMethod) {
17
- var command = {
18
- type: _types.ACTIONS.UPDATE_INLINE_COMMENT_STATE,
19
- data: partialNewState
16
+ var updateInlineCommentResolvedState = exports.updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
17
+ return function (partialNewState, resolveMethod) {
18
+ var command = {
19
+ type: _types.ACTIONS.UPDATE_INLINE_COMMENT_STATE,
20
+ data: partialNewState
21
+ };
22
+ var allResolved = Object.values(partialNewState).every(function (state) {
23
+ return state;
24
+ });
25
+ if (resolveMethod && allResolved) {
26
+ return (0, _pluginFactory.createCommand)(command, _transform.default.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
27
+ }
28
+ return (0, _pluginFactory.createCommand)(command);
20
29
  };
21
- var allResolved = Object.values(partialNewState).every(function (state) {
22
- return state;
23
- });
24
- if (resolveMethod && allResolved) {
25
- return (0, _pluginFactory.createCommand)(command, _transform.default.addResolveAnalytics(resolveMethod));
26
- }
27
- return (0, _pluginFactory.createCommand)(command);
28
30
  };
29
31
  var closeComponent = exports.closeComponent = function closeComponent() {
30
32
  return (0, _pluginFactory.createCommand)({
@@ -74,29 +76,33 @@ var getDraftCommandAction = function getDraftCommandAction(drafting) {
74
76
  };
75
77
  };
76
78
  };
77
- var setInlineCommentDraftState = exports.setInlineCommentDraftState = function setInlineCommentDraftState(drafting) {
78
- var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
79
- var commandAction = getDraftCommandAction(drafting);
80
- return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(drafting, inputMethod));
79
+ var setInlineCommentDraftState = exports.setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
80
+ return function (drafting) {
81
+ var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
82
+ var commandAction = getDraftCommandAction(drafting);
83
+ return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
84
+ };
81
85
  };
82
- var addInlineComment = exports.addInlineComment = function addInlineComment(id) {
83
- var commandAction = function commandAction(editorState) {
84
- return {
85
- type: _types.ACTIONS.ADD_INLINE_COMMENT,
86
- data: {
87
- drafting: false,
88
- inlineComments: (0, _defineProperty2.default)({}, id, false),
89
- // Auto make the newly inserted comment selected.
90
- // We move the selection to the head of the comment selection.
91
- selectedAnnotations: [{
92
- id: id,
93
- type: _adfSchema.AnnotationTypes.INLINE_COMMENT
94
- }],
95
- editorState: editorState
96
- }
86
+ var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI) {
87
+ return function (id) {
88
+ var commandAction = function commandAction(editorState) {
89
+ return {
90
+ type: _types.ACTIONS.ADD_INLINE_COMMENT,
91
+ data: {
92
+ drafting: false,
93
+ inlineComments: (0, _defineProperty2.default)({}, id, false),
94
+ // Auto make the newly inserted comment selected.
95
+ // We move the selection to the head of the comment selection.
96
+ selectedAnnotations: [{
97
+ id: id,
98
+ type: _adfSchema.AnnotationTypes.INLINE_COMMENT
99
+ }],
100
+ editorState: editorState
101
+ }
102
+ };
97
103
  };
104
+ return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI)(id));
98
105
  };
99
- return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(id));
100
106
  };
101
107
  var updateMouseState = exports.updateMouseState = function updateMouseState(mouseData) {
102
108
  return (0, _pluginFactory.createCommand)({
@@ -117,19 +123,21 @@ var setSelectedAnnotation = exports.setSelectedAnnotation = function setSelected
117
123
  }
118
124
  });
119
125
  };
120
- var createAnnotation = exports.createAnnotation = function createAnnotation(id) {
121
- var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
122
- return function (state, dispatch) {
123
- // don't try to add if there are is no temp highlight bookmarked
124
- var _ref = (0, _utils.getPluginState)(state) || {},
125
- bookmark = _ref.bookmark;
126
- if (!bookmark || !dispatch) {
126
+ var createAnnotation = exports.createAnnotation = function createAnnotation(editorAnalyticsAPI) {
127
+ return function (id) {
128
+ var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
129
+ return function (state, dispatch) {
130
+ // don't try to add if there are is no temp highlight bookmarked
131
+ var _ref = (0, _utils.getPluginState)(state) || {},
132
+ bookmark = _ref.bookmark;
133
+ if (!bookmark || !dispatch) {
134
+ return false;
135
+ }
136
+ if (annotationType === _adfSchema.AnnotationTypes.INLINE_COMMENT) {
137
+ return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
138
+ }
127
139
  return false;
128
- }
129
- if (annotationType === _adfSchema.AnnotationTypes.INLINE_COMMENT) {
130
- return addInlineComment(id)(state, dispatch);
131
- }
132
- return false;
140
+ };
133
141
  };
134
142
  };
135
143
  var setInlineCommentsVisibility = exports.setInlineCommentsVisibility = function setInlineCommentsVisibility(isVisible) {
@@ -7,13 +7,12 @@ exports.default = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
8
  var _adfSchema = require("@atlaskit/adf-schema");
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
- var _utils = require("../../analytics/utils");
11
- var _utils2 = require("../utils");
10
+ var _utils = require("../utils");
12
11
  var _mark = require("@atlaskit/editor-common/mark");
13
12
  var addAnnotationMark = function addAnnotationMark(id) {
14
13
  return function (transaction, state) {
15
- var inlineCommentState = (0, _utils2.getPluginState)(state);
16
- var _getSelectionPosition = (0, _utils2.getSelectionPositions)(state, inlineCommentState),
14
+ var inlineCommentState = (0, _utils.getPluginState)(state);
15
+ var _getSelectionPosition = (0, _utils.getSelectionPositions)(state, inlineCommentState),
17
16
  from = _getSelectionPosition.from,
18
17
  to = _getSelectionPosition.to,
19
18
  head = _getSelectionPosition.head;
@@ -28,43 +27,54 @@ var addAnnotationMark = function addAnnotationMark(id) {
28
27
  return tr;
29
28
  };
30
29
  };
31
- var addInlineComment = function addInlineComment(id) {
32
- return function (transaction, state) {
33
- var tr = addAnnotationMark(id)(transaction, state);
34
- // add insert analytics step to transaction
35
- tr = addInsertAnalytics(tr, state);
36
- // add close analytics step to transaction
37
- tr = addOpenCloseAnalytics(false, _analytics.INPUT_METHOD.TOOLBAR)(tr, state);
38
- return tr;
30
+ var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
31
+ return function (id) {
32
+ return function (transaction, state) {
33
+ var tr = addAnnotationMark(id)(transaction, state);
34
+ // add insert analytics step to transaction
35
+ tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
36
+ // add close analytics step to transaction
37
+ tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, _analytics.INPUT_METHOD.TOOLBAR)(tr, state);
38
+ return tr;
39
+ };
39
40
  };
40
41
  };
41
- var addOpenCloseAnalytics = function addOpenCloseAnalytics(drafting) {
42
- var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
43
- return function (transaction, state) {
44
- var draftingPayload = (0, _utils2.getDraftCommandAnalyticsPayload)(drafting, method)(state);
45
- return (0, _utils.addAnalytics)(state, transaction, draftingPayload);
42
+ var addOpenCloseAnalytics = function addOpenCloseAnalytics(editorAnalyticsAPI) {
43
+ return function (drafting) {
44
+ var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
45
+ return function (transaction, state) {
46
+ var draftingPayload = (0, _utils.getDraftCommandAnalyticsPayload)(drafting, method)(state);
47
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
48
+ return transaction;
49
+ };
46
50
  };
47
51
  };
48
- var addInsertAnalytics = function addInsertAnalytics(transaction, state) {
49
- return (0, _utils.addAnalytics)(state, transaction, {
50
- action: _analytics.ACTION.INSERTED,
51
- actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
52
- eventType: _analytics.EVENT_TYPE.TRACK,
53
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT
54
- });
55
- };
56
- var addResolveAnalytics = function addResolveAnalytics(method) {
52
+ var addInsertAnalytics = function addInsertAnalytics(editorAnalyticsAPI) {
57
53
  return function (transaction, state) {
58
- var resolvedPayload = {
59
- action: _analytics.ACTION.RESOLVED,
54
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
55
+ action: _analytics.ACTION.INSERTED,
60
56
  actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
61
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
62
57
  eventType: _analytics.EVENT_TYPE.TRACK,
63
- attributes: {
64
- method: method
65
- }
58
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT
59
+ })(transaction);
60
+ return transaction;
61
+ };
62
+ };
63
+ var addResolveAnalytics = function addResolveAnalytics(editorAnalyticsAPI) {
64
+ return function (method) {
65
+ return function (transaction, state) {
66
+ var resolvedPayload = {
67
+ action: _analytics.ACTION.RESOLVED,
68
+ actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
69
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
70
+ eventType: _analytics.EVENT_TYPE.TRACK,
71
+ attributes: {
72
+ method: method
73
+ }
74
+ };
75
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(resolvedPayload)(transaction);
76
+ return transaction;
66
77
  };
67
- return (0, _utils.addAnalytics)(state, transaction, resolvedPayload);
68
78
  };
69
79
  };
70
80
  var _default = exports.default = {
@@ -46,11 +46,13 @@ var annotationPlugin = function annotationPlugin(_ref) {
46
46
  portalProviderAPI = _ref2.portalProviderAPI,
47
47
  eventDispatcher = _ref2.eventDispatcher;
48
48
  if (annotationProviders) {
49
+ var _api$analytics;
49
50
  return (0, _inlineComment.inlineCommentPlugin)({
50
51
  dispatch: dispatch,
51
52
  portalProviderAPI: portalProviderAPI,
52
53
  eventDispatcher: eventDispatcher,
53
- provider: annotationProviders.inlineComment
54
+ provider: annotationProviders.inlineComment,
55
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
54
56
  });
55
57
  }
56
58
  return;
@@ -59,7 +61,8 @@ var annotationPlugin = function annotationPlugin(_ref) {
59
61
  name: 'annotationKeymap',
60
62
  plugin: function plugin() {
61
63
  if (annotationProviders) {
62
- return (0, _keymap.keymapPlugin)();
64
+ var _api$analytics2;
65
+ return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
63
66
  }
64
67
  return;
65
68
  }
@@ -72,8 +75,9 @@ var annotationPlugin = function annotationPlugin(_ref) {
72
75
  }
73
76
  var pluginState = (0, _utils.getPluginState)(state);
74
77
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
78
+ var _api$analytics3;
75
79
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
76
- return (0, _toolbar.buildToolbar)(state, intl, isToolbarAbove);
80
+ return (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, intl, isToolbarAbove);
77
81
  }
78
82
  },
79
83
  selectionToolbar: function selectionToolbar(state, intl) {
@@ -82,8 +86,9 @@ var annotationPlugin = function annotationPlugin(_ref) {
82
86
  }
83
87
  var pluginState = (0, _utils.getPluginState)(state);
84
88
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
89
+ var _api$analytics4;
85
90
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
86
- return (0, _toolbar.buildToolbar)(state, intl, isToolbarAbove);
91
+ return (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove);
87
92
  }
88
93
  }
89
94
  },
@@ -103,6 +108,7 @@ var annotationPlugin = function annotationPlugin(_ref) {
103
108
  };
104
109
  };
105
110
  function AnnotationContentComponent(_ref4) {
111
+ var _api$analytics5;
106
112
  var api = _ref4.api,
107
113
  editorView = _ref4.editorView,
108
114
  annotationProviders = _ref4.annotationProviders,
@@ -117,7 +123,8 @@ function AnnotationContentComponent(_ref4) {
117
123
  }, /*#__PURE__*/_react.default.createElement(_InlineCommentView.InlineCommentView, {
118
124
  providers: annotationProviders,
119
125
  editorView: editorView,
120
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
126
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
127
+ editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
121
128
  }));
122
129
  }
123
130
  var _default = exports.default = annotationPlugin;
@@ -47,7 +47,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
47
47
  // fetchState is unable to return a command as it's runs async and may dispatch at a later time
48
48
  // Requires `editorView` instead of the decomposition as the async means state may end up stale
49
49
  var fetchState = /*#__PURE__*/function () {
50
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(provider, annotationIds, editorView) {
50
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(provider, annotationIds, editorView, editorAnalyticsAPI) {
51
51
  var inlineCommentStates;
52
52
  return _regenerator.default.wrap(function _callee2$(_context2) {
53
53
  while (1) switch (_context2.prev = _context2.next) {
@@ -63,7 +63,7 @@ var fetchState = /*#__PURE__*/function () {
63
63
  case 4:
64
64
  inlineCommentStates = _context2.sent;
65
65
  if (editorView.dispatch) {
66
- (0, _commands.updateInlineCommentResolvedState)(inlineCommentStates)(editorView.state, editorView.dispatch);
66
+ (0, _commands.updateInlineCommentResolvedState)(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
67
67
  }
68
68
  case 6:
69
69
  case "end":
@@ -71,7 +71,7 @@ var fetchState = /*#__PURE__*/function () {
71
71
  }
72
72
  }, _callee2);
73
73
  }));
74
- return function fetchState(_x3, _x4, _x5) {
74
+ return function fetchState(_x3, _x4, _x5, _x6) {
75
75
  return _ref2.apply(this, arguments);
76
76
  };
77
77
  }();
@@ -97,14 +97,18 @@ var hideToolbar = function hideToolbar(state, dispatch) {
97
97
  };
98
98
 
99
99
  // Subscribe to updates from consumer
100
- var onResolve = function onResolve(state, dispatch) {
101
- return function (annotationId) {
102
- (0, _commands.updateInlineCommentResolvedState)((0, _defineProperty2.default)({}, annotationId, true), _inlineCommentEvents.RESOLVE_METHOD.CONSUMER)(state, dispatch);
100
+ var onResolve = function onResolve(editorAnalyticsAPI) {
101
+ return function (state, dispatch) {
102
+ return function (annotationId) {
103
+ (0, _commands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, true), _inlineCommentEvents.RESOLVE_METHOD.CONSUMER)(state, dispatch);
104
+ };
103
105
  };
104
106
  };
105
- var onUnResolve = function onUnResolve(state, dispatch) {
106
- return function (annotationId) {
107
- (0, _commands.updateInlineCommentResolvedState)((0, _defineProperty2.default)({}, annotationId, false))(state, dispatch);
107
+ var onUnResolve = function onUnResolve(editorAnalyticsAPI) {
108
+ return function (state, dispatch) {
109
+ return function (annotationId) {
110
+ (0, _commands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, annotationId, false))(state, dispatch);
111
+ };
108
112
  };
109
113
  };
110
114
  var onMouseUp = function onMouseUp(state, dispatch) {
@@ -142,12 +146,12 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
142
146
  view: function view(editorView) {
143
147
  // Get initial state
144
148
  // Need to pass `editorView` to mitigate editor state going stale
145
- fetchState(provider, (0, _utils.getAllAnnotations)(editorView.state.doc), editorView);
149
+ fetchState(provider, (0, _utils.getAllAnnotations)(editorView.state.doc), editorView, options.editorAnalyticsAPI);
146
150
  var resolve = function resolve(annotationId) {
147
- return onResolve(editorView.state, editorView.dispatch)(annotationId);
151
+ return onResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
148
152
  };
149
153
  var unResolve = function unResolve(annotationId) {
150
- return onUnResolve(editorView.state, editorView.dispatch)(annotationId);
154
+ return onUnResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
151
155
  };
152
156
  var mouseUp = function mouseUp(event) {
153
157
  return onMouseUp(editorView.state, editorView.dispatch)(event);
@@ -175,7 +179,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
175
179
  return;
176
180
  }
177
181
  (0, _commands.clearDirtyMark)()(view.state, view.dispatch);
178
- fetchState(provider, (0, _utils.getAllAnnotations)(view.state.doc), view);
182
+ fetchState(provider, (0, _utils.getAllAnnotations)(view.state.doc), view, options.editorAnalyticsAPI);
179
183
  },
180
184
  destroy: function destroy() {
181
185
  editorView.root.removeEventListener('mouseup', mouseUp);
@@ -8,8 +8,8 @@ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
8
8
  var _keymaps = require("../../../keymaps");
9
9
  var _commands = require("../commands");
10
10
  var _analytics = require("../../analytics");
11
- function keymapPlugin() {
11
+ function keymapPlugin(editorAnalyticsAPI) {
12
12
  var list = {};
13
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.addInlineComment.common, (0, _commands.setInlineCommentDraftState)(true, _analytics.INPUT_METHOD.SHORTCUT), list);
13
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.addInlineComment.common, (0, _commands.setInlineCommentDraftState)(editorAnalyticsAPI)(true, _analytics.INPUT_METHOD.SHORTCUT), list);
14
14
  return (0, _keymap.keymap)(list);
15
15
  }
@@ -13,45 +13,47 @@ var _types = require("./types");
13
13
  var _utils = require("./utils");
14
14
  var _messages = require("@atlaskit/editor-common/messages");
15
15
  var _utils2 = require("@atlaskit/editor-common/utils");
16
- var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl) {
17
- var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
18
- var schema = state.schema;
19
- var selectionValid = (0, _utils.isSelectionValid)(state);
20
- if (selectionValid === _types.AnnotationSelectionType.INVALID) {
21
- return undefined;
22
- }
23
- var createCommentMessage = intl.formatMessage(_messages.annotationMessages.createComment);
24
- var commentDisabledMessage = intl.formatMessage(_messages.annotationMessages.createCommentInvalid);
25
- var createComment = {
26
- type: 'button',
27
- showTitle: true,
28
- disabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
29
- testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
30
- icon: _comment.default,
31
- tooltipContent: selectionValid === _types.AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
32
- description: createCommentMessage,
33
- keymap: _keymaps.addInlineComment
34
- }),
35
- title: createCommentMessage,
36
- onClick: function onClick(state, dispatch) {
37
- return (0, _commands.setInlineCommentDraftState)(true)(state, dispatch);
16
+ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsAPI) {
17
+ return function (state, intl) {
18
+ var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
19
+ var schema = state.schema;
20
+ var selectionValid = (0, _utils.isSelectionValid)(state);
21
+ if (selectionValid === _types.AnnotationSelectionType.INVALID) {
22
+ return undefined;
38
23
  }
39
- };
40
- var annotation = schema.marks.annotation;
41
- var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
42
- var type = schema.nodes[current];
43
- if (type.allowsMarkType(annotation)) {
44
- acc.push(type);
45
- }
46
- return acc;
47
- }, []);
48
- var toolbarTitle = intl.formatMessage(_messages.annotationMessages.toolbar);
49
- var calcToolbarPosition = isToolbarAbove ? _utils2.calculateToolbarPositionAboveSelection : _utils2.calculateToolbarPositionTrackHead;
50
- var onPositionCalculated = calcToolbarPosition(toolbarTitle);
51
- return {
52
- title: toolbarTitle,
53
- nodeType: validNodes,
54
- items: [createComment],
55
- onPositionCalculated: onPositionCalculated
24
+ var createCommentMessage = intl.formatMessage(_messages.annotationMessages.createComment);
25
+ var commentDisabledMessage = intl.formatMessage(_messages.annotationMessages.createCommentInvalid);
26
+ var createComment = {
27
+ type: 'button',
28
+ showTitle: true,
29
+ disabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
30
+ testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
31
+ icon: _comment.default,
32
+ tooltipContent: selectionValid === _types.AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
33
+ description: createCommentMessage,
34
+ keymap: _keymaps.addInlineComment
35
+ }),
36
+ title: createCommentMessage,
37
+ onClick: function onClick(state, dispatch) {
38
+ return (0, _commands.setInlineCommentDraftState)(editorAnalyticsAPI)(true)(state, dispatch);
39
+ }
40
+ };
41
+ var annotation = schema.marks.annotation;
42
+ var validNodes = Object.keys(schema.nodes).reduce(function (acc, current) {
43
+ var type = schema.nodes[current];
44
+ if (type.allowsMarkType(annotation)) {
45
+ acc.push(type);
46
+ }
47
+ return acc;
48
+ }, []);
49
+ var toolbarTitle = intl.formatMessage(_messages.annotationMessages.toolbar);
50
+ var calcToolbarPosition = isToolbarAbove ? _utils2.calculateToolbarPositionAboveSelection : _utils2.calculateToolbarPositionTrackHead;
51
+ var onPositionCalculated = calcToolbarPosition(toolbarTitle);
52
+ return {
53
+ title: toolbarTitle,
54
+ nodeType: validNodes,
55
+ items: [createComment],
56
+ onPositionCalculated: onPositionCalculated
57
+ };
56
58
  };
57
59
  };
@@ -34,6 +34,7 @@ var findPosForDOM = function findPosForDOM(sel) {
34
34
  function InlineCommentView(_ref) {
35
35
  var providers = _ref.providers,
36
36
  editorView = _ref.editorView,
37
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI,
37
38
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
38
39
  // As inlineComment is the only annotation present, this function is not generic
39
40
  var inlineCommentProvider = providers.inlineComment;
@@ -93,11 +94,11 @@ function InlineCommentView(_ref) {
93
94
  dom: dom,
94
95
  textSelection: textSelection,
95
96
  onCreate: function onCreate(id) {
96
- (0, _commands.createAnnotation)(id)(editorView.state, editorView.dispatch);
97
+ (0, _commands.createAnnotation)(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
97
98
  !editorView.hasFocus() && editorView.focus();
98
99
  },
99
100
  onClose: function onClose() {
100
- (0, _commands.setInlineCommentDraftState)(false)(editorView.state, editorView.dispatch);
101
+ (0, _commands.setInlineCommentDraftState)(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
101
102
  !editorView.hasFocus() && editorView.focus();
102
103
  }
103
104
  }));
@@ -142,7 +143,7 @@ function InlineCommentView(_ref) {
142
143
  return (0, _commands.removeInlineCommentNearSelection)(id)(state, dispatch);
143
144
  },
144
145
  onResolve: function onResolve(id) {
145
- return (0, _commands.updateInlineCommentResolvedState)((0, _defineProperty2.default)({}, id, true), _inlineCommentEvents.RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
146
+ return (0, _commands.updateInlineCommentResolvedState)(editorAnalyticsAPI)((0, _defineProperty2.default)({}, id, true), _inlineCommentEvents.RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
146
147
  },
147
148
  onClose: function onClose() {
148
149
  (0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
@@ -101,12 +101,6 @@ Object.defineProperty(exports, "findReplacePlugin", {
101
101
  return _findReplace.default;
102
102
  }
103
103
  });
104
- Object.defineProperty(exports, "fragmentMarkPlugin", {
105
- enumerable: true,
106
- get: function get() {
107
- return _fragment.default;
108
- }
109
- });
110
104
  Object.defineProperty(exports, "indentationPlugin", {
111
105
  enumerable: true,
112
106
  get: function get() {
@@ -220,7 +214,6 @@ var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions")
220
214
  var _breakout = _interopRequireDefault(require("./breakout"));
221
215
  var _alignment = _interopRequireDefault(require("./alignment"));
222
216
  var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
223
- var _fragment = _interopRequireDefault(require("./fragment"));
224
217
  var _indentation = _interopRequireDefault(require("./indentation"));
225
218
  var _annotation = _interopRequireDefault(require("./annotation"));
226
219
  var _analytics = _interopRequireDefault(require("./analytics"));
@@ -17,6 +17,7 @@ var _editorPluginBorder = require("@atlaskit/editor-plugin-border");
17
17
  var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
18
18
  var _editorPluginMedia = require("@atlaskit/editor-plugin-media");
19
19
  var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
20
+ var _editorPluginFragment = require("@atlaskit/editor-plugin-fragment");
20
21
  var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
21
22
  var _editorPluginPasteOptionsToolbar = require("@atlaskit/editor-plugin-paste-options-toolbar");
22
23
  var _editorPluginList = require("@atlaskit/editor-plugin-list");
@@ -391,7 +392,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
391
392
  return builder.add(plugin);
392
393
  }
393
394
  return builder;
394
- }).maybeAdd(_plugins.fragmentMarkPlugin, function (plugin, builder) {
395
+ }).maybeAdd(_editorPluginFragment.fragmentPlugin, function (plugin, builder) {
395
396
  if (props.allowFragmentMark) {
396
397
  return builder.add(plugin);
397
398
  }
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "findFarthestParentNode", {
10
10
  return _utils.findFarthestParentNode;
11
11
  }
12
12
  });
13
- exports.getChangedNodes = getChangedNodes;
14
- exports.getChangedNodesIn = getChangedNodesIn;
15
13
  exports.getChildBreakoutModes = getChildBreakoutModes;
16
14
  exports.getNodesCount = getNodesCount;
17
15
  Object.defineProperty(exports, "isInEmptyLine", {
@@ -40,30 +38,6 @@ function processRawFragmentValue(schema, value, providerFactory, sanitizePrivate
40
38
  }
41
39
  return _model.Fragment.from(adfEntities);
42
40
  }
43
- function getChangedNodesIn(_ref) {
44
- var tr = _ref.tr,
45
- doc = _ref.doc;
46
- var nodes = [];
47
- var stepRange = (0, _utils.getStepRange)(tr);
48
- if (!stepRange) {
49
- return nodes;
50
- }
51
- var from = Math.min(doc.nodeSize - 2, stepRange.from);
52
- var to = Math.min(doc.nodeSize - 2, stepRange.to);
53
- doc.nodesBetween(from, to, function (node, pos) {
54
- nodes.push({
55
- node: node,
56
- pos: pos
57
- });
58
- });
59
- return nodes;
60
- }
61
- function getChangedNodes(tr) {
62
- return getChangedNodesIn({
63
- tr: tr,
64
- doc: tr.doc
65
- });
66
- }
67
41
  function nodesBetweenChanged(tr, f, startPos) {
68
42
  var stepRange = (0, _utils.getStepRange)(tr);
69
43
  if (!stepRange) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.1.0";
8
+ var version = exports.version = "189.1.1";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -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';