@atlaskit/editor-core 189.1.0 → 189.1.2

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 +15 -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 +5 -4
  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
@@ -5,14 +5,14 @@ import { isSelectionValid, getPluginState } from '../utils';
5
5
  import { ACTIONS } from '../pm-plugins/types';
6
6
  import transform from './transform';
7
7
  import { AnnotationSelectionType } from '../types';
8
- export const updateInlineCommentResolvedState = (partialNewState, resolveMethod) => {
8
+ export const updateInlineCommentResolvedState = editorAnalyticsAPI => (partialNewState, resolveMethod) => {
9
9
  const command = {
10
10
  type: ACTIONS.UPDATE_INLINE_COMMENT_STATE,
11
11
  data: partialNewState
12
12
  };
13
13
  const allResolved = Object.values(partialNewState).every(state => state);
14
14
  if (resolveMethod && allResolved) {
15
- return createCommand(command, transform.addResolveAnalytics(resolveMethod));
15
+ return createCommand(command, transform.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
16
16
  }
17
17
  return createCommand(command);
18
18
  };
@@ -62,11 +62,11 @@ const getDraftCommandAction = drafting => {
62
62
  };
63
63
  };
64
64
  };
65
- export const setInlineCommentDraftState = (drafting, inputMethod = INPUT_METHOD.TOOLBAR) => {
65
+ export const setInlineCommentDraftState = editorAnalyticsAPI => (drafting, inputMethod = INPUT_METHOD.TOOLBAR) => {
66
66
  const commandAction = getDraftCommandAction(drafting);
67
- return createCommand(commandAction, transform.addOpenCloseAnalytics(drafting, inputMethod));
67
+ return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
68
68
  };
69
- export const addInlineComment = id => {
69
+ export const addInlineComment = editorAnalyticsAPI => id => {
70
70
  const commandAction = editorState => ({
71
71
  type: ACTIONS.ADD_INLINE_COMMENT,
72
72
  data: {
@@ -83,7 +83,7 @@ export const addInlineComment = id => {
83
83
  editorState
84
84
  }
85
85
  });
86
- return createCommand(commandAction, transform.addInlineComment(id));
86
+ return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI)(id));
87
87
  };
88
88
  export const updateMouseState = mouseData => createCommand({
89
89
  type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE,
@@ -100,7 +100,7 @@ export const setSelectedAnnotation = id => createCommand({
100
100
  }]
101
101
  }
102
102
  });
103
- export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
103
+ export const createAnnotation = editorAnalyticsAPI => (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
104
104
  // don't try to add if there are is no temp highlight bookmarked
105
105
  const {
106
106
  bookmark
@@ -109,7 +109,7 @@ export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COM
109
109
  return false;
110
110
  }
111
111
  if (annotationType === AnnotationTypes.INLINE_COMMENT) {
112
- return addInlineComment(id)(state, dispatch);
112
+ return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
113
113
  }
114
114
  return false;
115
115
  };
@@ -1,7 +1,6 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { addAnalytics } from '../../analytics/utils';
5
4
  import { getSelectionPositions, getPluginState, getDraftCommandAnalyticsPayload } from '../utils';
6
5
  import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
7
6
  const addAnnotationMark = id => (transaction, state) => {
@@ -21,27 +20,29 @@ const addAnnotationMark = id => (transaction, state) => {
21
20
  tr.setSelection(TextSelection.create(tr.doc, head));
22
21
  return tr;
23
22
  };
24
- const addInlineComment = id => (transaction, state) => {
23
+ const addInlineComment = editorAnalyticsAPI => id => (transaction, state) => {
25
24
  let tr = addAnnotationMark(id)(transaction, state);
26
25
  // add insert analytics step to transaction
27
- tr = addInsertAnalytics(tr, state);
26
+ tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
28
27
  // add close analytics step to transaction
29
- tr = addOpenCloseAnalytics(false, INPUT_METHOD.TOOLBAR)(tr, state);
28
+ tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, INPUT_METHOD.TOOLBAR)(tr, state);
30
29
  return tr;
31
30
  };
32
- const addOpenCloseAnalytics = (drafting, method = INPUT_METHOD.TOOLBAR) => (transaction, state) => {
31
+ const addOpenCloseAnalytics = editorAnalyticsAPI => (drafting, method = INPUT_METHOD.TOOLBAR) => (transaction, state) => {
33
32
  const draftingPayload = getDraftCommandAnalyticsPayload(drafting, method)(state);
34
- return addAnalytics(state, transaction, draftingPayload);
33
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
34
+ return transaction;
35
35
  };
36
- const addInsertAnalytics = (transaction, state) => {
37
- return addAnalytics(state, transaction, {
36
+ const addInsertAnalytics = editorAnalyticsAPI => (transaction, state) => {
37
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
38
38
  action: ACTION.INSERTED,
39
39
  actionSubject: ACTION_SUBJECT.ANNOTATION,
40
40
  eventType: EVENT_TYPE.TRACK,
41
41
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT
42
- });
42
+ })(transaction);
43
+ return transaction;
43
44
  };
44
- const addResolveAnalytics = method => (transaction, state) => {
45
+ const addResolveAnalytics = editorAnalyticsAPI => method => (transaction, state) => {
45
46
  const resolvedPayload = {
46
47
  action: ACTION.RESOLVED,
47
48
  actionSubject: ACTION_SUBJECT.ANNOTATION,
@@ -51,7 +52,8 @@ const addResolveAnalytics = method => (transaction, state) => {
51
52
  method
52
53
  }
53
54
  };
54
- return addAnalytics(state, transaction, resolvedPayload);
55
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(resolvedPayload)(transaction);
56
+ return transaction;
55
57
  };
56
58
  export default {
57
59
  addAnnotationMark,
@@ -34,11 +34,13 @@ const annotationPlugin = ({
34
34
  eventDispatcher
35
35
  }) => {
36
36
  if (annotationProviders) {
37
+ var _api$analytics;
37
38
  return inlineCommentPlugin({
38
39
  dispatch,
39
40
  portalProviderAPI,
40
41
  eventDispatcher,
41
- provider: annotationProviders.inlineComment
42
+ provider: annotationProviders.inlineComment,
43
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
42
44
  });
43
45
  }
44
46
  return;
@@ -47,7 +49,8 @@ const annotationPlugin = ({
47
49
  name: 'annotationKeymap',
48
50
  plugin: () => {
49
51
  if (annotationProviders) {
50
- return keymapPlugin();
52
+ var _api$analytics2;
53
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
51
54
  }
52
55
  return;
53
56
  }
@@ -59,10 +62,11 @@ const annotationPlugin = ({
59
62
  }
60
63
  const pluginState = getPluginState(state);
61
64
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
65
+ var _api$analytics3;
62
66
  const {
63
67
  isToolbarAbove
64
68
  } = annotationProviders.inlineComment;
65
- return buildToolbar(state, intl, isToolbarAbove);
69
+ return buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, intl, isToolbarAbove);
66
70
  }
67
71
  },
68
72
  selectionToolbar(state, intl) {
@@ -71,10 +75,11 @@ const annotationPlugin = ({
71
75
  }
72
76
  const pluginState = getPluginState(state);
73
77
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
78
+ var _api$analytics4;
74
79
  const {
75
80
  isToolbarAbove
76
81
  } = annotationProviders.inlineComment;
77
- return buildToolbar(state, intl, isToolbarAbove);
82
+ return buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(state, intl, isToolbarAbove);
78
83
  }
79
84
  }
80
85
  },
@@ -100,6 +105,7 @@ function AnnotationContentComponent({
100
105
  annotationProviders,
101
106
  dispatchAnalyticsEvent
102
107
  }) {
108
+ var _api$analytics5;
103
109
  const {
104
110
  annotationState: inlineCommentState
105
111
  } = useSharedPluginState(api, ['annotation']);
@@ -111,7 +117,8 @@ function AnnotationContentComponent({
111
117
  }, /*#__PURE__*/React.createElement(InlineCommentView, {
112
118
  providers: annotationProviders,
113
119
  editorView: editorView,
114
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
120
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
121
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions
115
122
  }));
116
123
  }
117
124
  export default annotationPlugin;
@@ -19,13 +19,13 @@ const fetchProviderStates = async (provider, annotationIds) => {
19
19
 
20
20
  // fetchState is unable to return a command as it's runs async and may dispatch at a later time
21
21
  // Requires `editorView` instead of the decomposition as the async means state may end up stale
22
- const fetchState = async (provider, annotationIds, editorView) => {
22
+ const fetchState = async (provider, annotationIds, editorView, editorAnalyticsAPI) => {
23
23
  if (!annotationIds || !annotationIds.length) {
24
24
  return;
25
25
  }
26
26
  const inlineCommentStates = await fetchProviderStates(provider, annotationIds);
27
27
  if (editorView.dispatch) {
28
- updateInlineCommentResolvedState(inlineCommentStates)(editorView.state, editorView.dispatch);
28
+ updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
29
29
  }
30
30
  };
31
31
  const initialState = (disallowOnWhitespace = false) => {
@@ -47,13 +47,13 @@ const hideToolbar = (state, dispatch) => () => {
47
47
  };
48
48
 
49
49
  // Subscribe to updates from consumer
50
- const onResolve = (state, dispatch) => annotationId => {
51
- updateInlineCommentResolvedState({
50
+ const onResolve = editorAnalyticsAPI => (state, dispatch) => annotationId => {
51
+ updateInlineCommentResolvedState(editorAnalyticsAPI)({
52
52
  [annotationId]: true
53
53
  }, RESOLVE_METHOD.CONSUMER)(state, dispatch);
54
54
  };
55
- const onUnResolve = (state, dispatch) => annotationId => {
56
- updateInlineCommentResolvedState({
55
+ const onUnResolve = editorAnalyticsAPI => (state, dispatch) => annotationId => {
56
+ updateInlineCommentResolvedState(editorAnalyticsAPI)({
57
57
  [annotationId]: false
58
58
  })(state, dispatch);
59
59
  };
@@ -93,9 +93,9 @@ export const inlineCommentPlugin = options => {
93
93
  view(editorView) {
94
94
  // Get initial state
95
95
  // Need to pass `editorView` to mitigate editor state going stale
96
- fetchState(provider, getAllAnnotations(editorView.state.doc), editorView);
97
- const resolve = annotationId => onResolve(editorView.state, editorView.dispatch)(annotationId);
98
- const unResolve = annotationId => onUnResolve(editorView.state, editorView.dispatch)(annotationId);
96
+ fetchState(provider, getAllAnnotations(editorView.state.doc), editorView, options.editorAnalyticsAPI);
97
+ const resolve = annotationId => onResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
98
+ const unResolve = annotationId => onUnResolve(options.editorAnalyticsAPI)(editorView.state, editorView.dispatch)(annotationId);
99
99
  const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
100
100
  const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
101
101
  const setSelectedAnnotationFn = annotationId => {
@@ -121,7 +121,7 @@ export const inlineCommentPlugin = options => {
121
121
  return;
122
122
  }
123
123
  clearDirtyMark()(view.state, view.dispatch);
124
- fetchState(provider, getAllAnnotations(view.state.doc), view);
124
+ fetchState(provider, getAllAnnotations(view.state.doc), view, options.editorAnalyticsAPI);
125
125
  },
126
126
  destroy() {
127
127
  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
  const 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,7 +6,7 @@ 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 const buildToolbar = (state, intl, isToolbarAbove = false) => {
9
+ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false) => {
10
10
  const {
11
11
  schema
12
12
  } = state;
@@ -28,7 +28,7 @@ export const buildToolbar = (state, intl, isToolbarAbove = false) => {
28
28
  }),
29
29
  title: createCommentMessage,
30
30
  onClick: (state, dispatch) => {
31
- return setInlineCommentDraftState(true)(state, dispatch);
31
+ return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
32
32
  }
33
33
  };
34
34
  const {
@@ -26,6 +26,7 @@ const findPosForDOM = sel => {
26
26
  export function InlineCommentView({
27
27
  providers,
28
28
  editorView,
29
+ editorAnalyticsAPI,
29
30
  dispatchAnalyticsEvent
30
31
  }) {
31
32
  // As inlineComment is the only annotation present, this function is not generic
@@ -93,11 +94,11 @@ export function InlineCommentView({
93
94
  dom: dom,
94
95
  textSelection: textSelection,
95
96
  onCreate: id => {
96
- createAnnotation(id)(editorView.state, editorView.dispatch);
97
+ createAnnotation(editorAnalyticsAPI)(id)(editorView.state, editorView.dispatch);
97
98
  !editorView.hasFocus() && editorView.focus();
98
99
  },
99
100
  onClose: () => {
100
- setInlineCommentDraftState(false)(editorView.state, editorView.dispatch);
101
+ setInlineCommentDraftState(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
101
102
  !editorView.hasFocus() && editorView.focus();
102
103
  }
103
104
  }));
@@ -137,7 +138,7 @@ export function InlineCommentView({
137
138
  annotations: activeAnnotations,
138
139
  dom: dom,
139
140
  onDelete: id => removeInlineCommentNearSelection(id)(state, dispatch),
140
- onResolve: id => updateInlineCommentResolvedState({
141
+ onResolve: id => updateInlineCommentResolvedState(editorAnalyticsAPI)({
141
142
  [id]: true
142
143
  }, RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch),
143
144
  onClose: () => {
@@ -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';
@@ -1,4 +1,4 @@
1
- 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';
1
+ 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';
2
2
  import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
3
3
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
4
4
  import { statusPlugin } from '@atlaskit/editor-plugin-status';
@@ -8,6 +8,7 @@ import { borderPlugin } from '@atlaskit/editor-plugin-border';
8
8
  import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
9
9
  import { mediaPlugin } from '@atlaskit/editor-plugin-media';
10
10
  import { rulePlugin } from '@atlaskit/editor-plugin-rule';
11
+ import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
11
12
  import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
12
13
  import { pasteOptionsToolbarPlugin } from '@atlaskit/editor-plugin-paste-options-toolbar';
13
14
  import { listPlugin } from '@atlaskit/editor-plugin-list';
@@ -388,7 +389,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
388
389
  return builder.add(plugin);
389
390
  }
390
391
  return builder;
391
- }).maybeAdd(fragmentMarkPlugin, (plugin, builder) => {
392
+ }).maybeAdd(fragmentPlugin, (plugin, builder) => {
392
393
  if (props.allowFragmentMark) {
393
394
  return builder.add(plugin);
394
395
  }
@@ -12,31 +12,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
12
12
  }
13
13
  return Fragment.from(adfEntities);
14
14
  }
15
- export function getChangedNodesIn({
16
- tr,
17
- doc
18
- }) {
19
- const nodes = [];
20
- const stepRange = getStepRange(tr);
21
- if (!stepRange) {
22
- return nodes;
23
- }
24
- const from = Math.min(doc.nodeSize - 2, stepRange.from);
25
- const to = Math.min(doc.nodeSize - 2, stepRange.to);
26
- doc.nodesBetween(from, to, (node, pos) => {
27
- nodes.push({
28
- node,
29
- pos
30
- });
31
- });
32
- return nodes;
33
- }
34
- export function getChangedNodes(tr) {
35
- return getChangedNodesIn({
36
- tr: tr,
37
- doc: tr.doc
38
- });
39
- }
40
15
  export function nodesBetweenChanged(tr, f, startPos) {
41
16
  const stepRange = getStepRange(tr);
42
17
  if (!stepRange) {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.1.0";
2
+ export const version = "189.1.2";
3
3
  export const 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';
@@ -6,18 +6,20 @@ import { isSelectionValid, getPluginState } from '../utils';
6
6
  import { ACTIONS } from '../pm-plugins/types';
7
7
  import transform from './transform';
8
8
  import { AnnotationSelectionType } from '../types';
9
- export var updateInlineCommentResolvedState = function updateInlineCommentResolvedState(partialNewState, resolveMethod) {
10
- var command = {
11
- type: ACTIONS.UPDATE_INLINE_COMMENT_STATE,
12
- data: partialNewState
9
+ export var updateInlineCommentResolvedState = function updateInlineCommentResolvedState(editorAnalyticsAPI) {
10
+ return function (partialNewState, resolveMethod) {
11
+ var command = {
12
+ type: ACTIONS.UPDATE_INLINE_COMMENT_STATE,
13
+ data: partialNewState
14
+ };
15
+ var allResolved = Object.values(partialNewState).every(function (state) {
16
+ return state;
17
+ });
18
+ if (resolveMethod && allResolved) {
19
+ return createCommand(command, transform.addResolveAnalytics(editorAnalyticsAPI)(resolveMethod));
20
+ }
21
+ return createCommand(command);
13
22
  };
14
- var allResolved = Object.values(partialNewState).every(function (state) {
15
- return state;
16
- });
17
- if (resolveMethod && allResolved) {
18
- return createCommand(command, transform.addResolveAnalytics(resolveMethod));
19
- }
20
- return createCommand(command);
21
23
  };
22
24
  export var closeComponent = function closeComponent() {
23
25
  return createCommand({
@@ -67,29 +69,33 @@ var getDraftCommandAction = function getDraftCommandAction(drafting) {
67
69
  };
68
70
  };
69
71
  };
70
- export var setInlineCommentDraftState = function setInlineCommentDraftState(drafting) {
71
- var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
72
- var commandAction = getDraftCommandAction(drafting);
73
- return createCommand(commandAction, transform.addOpenCloseAnalytics(drafting, inputMethod));
72
+ export var setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
73
+ return function (drafting) {
74
+ var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
75
+ var commandAction = getDraftCommandAction(drafting);
76
+ return createCommand(commandAction, transform.addOpenCloseAnalytics(editorAnalyticsAPI)(drafting, inputMethod));
77
+ };
74
78
  };
75
- export var addInlineComment = function addInlineComment(id) {
76
- var commandAction = function commandAction(editorState) {
77
- return {
78
- type: ACTIONS.ADD_INLINE_COMMENT,
79
- data: {
80
- drafting: false,
81
- inlineComments: _defineProperty({}, id, false),
82
- // Auto make the newly inserted comment selected.
83
- // We move the selection to the head of the comment selection.
84
- selectedAnnotations: [{
85
- id: id,
86
- type: AnnotationTypes.INLINE_COMMENT
87
- }],
88
- editorState: editorState
89
- }
79
+ export var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
80
+ return function (id) {
81
+ var commandAction = function commandAction(editorState) {
82
+ return {
83
+ type: ACTIONS.ADD_INLINE_COMMENT,
84
+ data: {
85
+ drafting: false,
86
+ inlineComments: _defineProperty({}, id, false),
87
+ // Auto make the newly inserted comment selected.
88
+ // We move the selection to the head of the comment selection.
89
+ selectedAnnotations: [{
90
+ id: id,
91
+ type: AnnotationTypes.INLINE_COMMENT
92
+ }],
93
+ editorState: editorState
94
+ }
95
+ };
90
96
  };
97
+ return createCommand(commandAction, transform.addInlineComment(editorAnalyticsAPI)(id));
91
98
  };
92
- return createCommand(commandAction, transform.addInlineComment(id));
93
99
  };
94
100
  export var updateMouseState = function updateMouseState(mouseData) {
95
101
  return createCommand({
@@ -110,19 +116,21 @@ export var setSelectedAnnotation = function setSelectedAnnotation(id) {
110
116
  }
111
117
  });
112
118
  };
113
- export var createAnnotation = function createAnnotation(id) {
114
- var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnnotationTypes.INLINE_COMMENT;
115
- return function (state, dispatch) {
116
- // don't try to add if there are is no temp highlight bookmarked
117
- var _ref = getPluginState(state) || {},
118
- bookmark = _ref.bookmark;
119
- if (!bookmark || !dispatch) {
119
+ export var createAnnotation = function createAnnotation(editorAnalyticsAPI) {
120
+ return function (id) {
121
+ var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 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 = getPluginState(state) || {},
125
+ bookmark = _ref.bookmark;
126
+ if (!bookmark || !dispatch) {
127
+ return false;
128
+ }
129
+ if (annotationType === AnnotationTypes.INLINE_COMMENT) {
130
+ return addInlineComment(editorAnalyticsAPI)(id)(state, dispatch);
131
+ }
120
132
  return false;
121
- }
122
- if (annotationType === AnnotationTypes.INLINE_COMMENT) {
123
- return addInlineComment(id)(state, dispatch);
124
- }
125
- return false;
133
+ };
126
134
  };
127
135
  };
128
136
  export var setInlineCommentsVisibility = function setInlineCommentsVisibility(isVisible) {
@@ -1,7 +1,6 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { addAnalytics } from '../../analytics/utils';
5
4
  import { getSelectionPositions, getPluginState, getDraftCommandAnalyticsPayload } from '../utils';
6
5
  import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
7
6
  var addAnnotationMark = function addAnnotationMark(id) {
@@ -22,43 +21,54 @@ var addAnnotationMark = function addAnnotationMark(id) {
22
21
  return tr;
23
22
  };
24
23
  };
25
- var addInlineComment = function addInlineComment(id) {
26
- return function (transaction, state) {
27
- var tr = addAnnotationMark(id)(transaction, state);
28
- // add insert analytics step to transaction
29
- tr = addInsertAnalytics(tr, state);
30
- // add close analytics step to transaction
31
- tr = addOpenCloseAnalytics(false, INPUT_METHOD.TOOLBAR)(tr, state);
32
- return tr;
24
+ var addInlineComment = function addInlineComment(editorAnalyticsAPI) {
25
+ return function (id) {
26
+ return function (transaction, state) {
27
+ var tr = addAnnotationMark(id)(transaction, state);
28
+ // add insert analytics step to transaction
29
+ tr = addInsertAnalytics(editorAnalyticsAPI)(tr, state);
30
+ // add close analytics step to transaction
31
+ tr = addOpenCloseAnalytics(editorAnalyticsAPI)(false, INPUT_METHOD.TOOLBAR)(tr, state);
32
+ return tr;
33
+ };
33
34
  };
34
35
  };
35
- var addOpenCloseAnalytics = function addOpenCloseAnalytics(drafting) {
36
- var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
37
- return function (transaction, state) {
38
- var draftingPayload = getDraftCommandAnalyticsPayload(drafting, method)(state);
39
- return addAnalytics(state, transaction, draftingPayload);
36
+ var addOpenCloseAnalytics = function addOpenCloseAnalytics(editorAnalyticsAPI) {
37
+ return function (drafting) {
38
+ var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INPUT_METHOD.TOOLBAR;
39
+ return function (transaction, state) {
40
+ var draftingPayload = getDraftCommandAnalyticsPayload(drafting, method)(state);
41
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(draftingPayload)(transaction);
42
+ return transaction;
43
+ };
40
44
  };
41
45
  };
42
- var addInsertAnalytics = function addInsertAnalytics(transaction, state) {
43
- return addAnalytics(state, transaction, {
44
- action: ACTION.INSERTED,
45
- actionSubject: ACTION_SUBJECT.ANNOTATION,
46
- eventType: EVENT_TYPE.TRACK,
47
- actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT
48
- });
49
- };
50
- var addResolveAnalytics = function addResolveAnalytics(method) {
46
+ var addInsertAnalytics = function addInsertAnalytics(editorAnalyticsAPI) {
51
47
  return function (transaction, state) {
52
- var resolvedPayload = {
53
- action: ACTION.RESOLVED,
48
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
49
+ action: ACTION.INSERTED,
54
50
  actionSubject: ACTION_SUBJECT.ANNOTATION,
55
- actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
56
51
  eventType: EVENT_TYPE.TRACK,
57
- attributes: {
58
- method: method
59
- }
52
+ actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT
53
+ })(transaction);
54
+ return transaction;
55
+ };
56
+ };
57
+ var addResolveAnalytics = function addResolveAnalytics(editorAnalyticsAPI) {
58
+ return function (method) {
59
+ return function (transaction, state) {
60
+ var resolvedPayload = {
61
+ action: ACTION.RESOLVED,
62
+ actionSubject: ACTION_SUBJECT.ANNOTATION,
63
+ actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
64
+ eventType: EVENT_TYPE.TRACK,
65
+ attributes: {
66
+ method: method
67
+ }
68
+ };
69
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(resolvedPayload)(transaction);
70
+ return transaction;
60
71
  };
61
- return addAnalytics(state, transaction, resolvedPayload);
62
72
  };
63
73
  };
64
74
  export default {