@atlaskit/editor-core 187.3.5 → 187.4.0

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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +105 -88
  3. package/dist/cjs/plugins/text-formatting/index.js +8 -6
  4. package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  5. package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +5 -5
  6. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +64 -59
  7. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +2 -1
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +18 -17
  11. package/dist/es2019/plugins/text-formatting/index.js +12 -6
  12. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  13. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +5 -5
  14. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +24 -21
  15. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +2 -1
  16. package/dist/es2019/version-wrapper.js +1 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +105 -88
  19. package/dist/esm/plugins/text-formatting/index.js +8 -6
  20. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  21. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +5 -5
  22. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +64 -59
  23. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +2 -1
  24. package/dist/esm/version-wrapper.js +1 -1
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
  27. package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
  28. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
  29. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
  30. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
  31. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
  32. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
  33. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
  34. package/package.json +1 -5
  35. package/report.api.md +21 -7
  36. package/tmp/api-report-tmp.d.ts +7 -7
@@ -1,7 +1,8 @@
1
1
  import { Selection } from 'prosemirror-state';
2
2
  import { applyMarkOnRange, toggleMark } from '../../../utils/commands';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { hasCode, markActive } from '../utils';
5
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
5
6
  export const moveRight = () => {
6
7
  return (state, dispatch) => {
7
8
  const {
@@ -117,9 +118,9 @@ export const toggleEm = () => {
117
118
  return false;
118
119
  };
119
120
  };
120
- export const toggleEmWithAnalytics = ({
121
+ export const toggleEmWithAnalytics = editorAnalyticsAPI => ({
121
122
  inputMethod
122
- }) => withAnalytics({
123
+ }) => withAnalytics(editorAnalyticsAPI, {
123
124
  action: ACTION.FORMATTED,
124
125
  actionSubject: ACTION_SUBJECT.TEXT,
125
126
  eventType: EVENT_TYPE.TRACK,
@@ -139,9 +140,9 @@ export const toggleStrike = () => {
139
140
  return false;
140
141
  };
141
142
  };
142
- export const toggleStrikeWithAnalytics = ({
143
+ export const toggleStrikeWithAnalytics = editorAnalyticsAPI => ({
143
144
  inputMethod
144
- }) => withAnalytics({
145
+ }) => withAnalytics(editorAnalyticsAPI, {
145
146
  action: ACTION.FORMATTED,
146
147
  actionSubject: ACTION_SUBJECT.TEXT,
147
148
  eventType: EVENT_TYPE.TRACK,
@@ -161,9 +162,9 @@ export const toggleStrong = () => {
161
162
  return false;
162
163
  };
163
164
  };
164
- export const toggleStrongWithAnalytics = ({
165
+ export const toggleStrongWithAnalytics = editorAnalyticsAPI => ({
165
166
  inputMethod
166
- }) => withAnalytics({
167
+ }) => withAnalytics(editorAnalyticsAPI, {
167
168
  action: ACTION.FORMATTED,
168
169
  actionSubject: ACTION_SUBJECT.TEXT,
169
170
  eventType: EVENT_TYPE.TRACK,
@@ -183,9 +184,9 @@ export const toggleUnderline = () => {
183
184
  return false;
184
185
  };
185
186
  };
186
- export const toggleUnderlineWithAnalytics = ({
187
+ export const toggleUnderlineWithAnalytics = editorAnalyticsAPI => ({
187
188
  inputMethod
188
- }) => withAnalytics({
189
+ }) => withAnalytics(editorAnalyticsAPI, {
189
190
  action: ACTION.FORMATTED,
190
191
  actionSubject: ACTION_SUBJECT.TEXT,
191
192
  eventType: EVENT_TYPE.TRACK,
@@ -207,9 +208,9 @@ export const toggleSuperscript = () => {
207
208
  return false;
208
209
  };
209
210
  };
210
- export const toggleSuperscriptWithAnalytics = ({
211
+ export const toggleSuperscriptWithAnalytics = editorAnalyticsAPI => ({
211
212
  inputMethod
212
- }) => withAnalytics({
213
+ }) => withAnalytics(editorAnalyticsAPI, {
213
214
  action: ACTION.FORMATTED,
214
215
  actionSubject: ACTION_SUBJECT.TEXT,
215
216
  eventType: EVENT_TYPE.TRACK,
@@ -231,9 +232,9 @@ export const toggleSubscript = () => {
231
232
  return false;
232
233
  };
233
234
  };
234
- export const toggleSubscriptWithAnalytics = ({
235
+ export const toggleSubscriptWithAnalytics = editorAnalyticsAPI => ({
235
236
  inputMethod
236
- }) => withAnalytics({
237
+ }) => withAnalytics(editorAnalyticsAPI, {
237
238
  action: ACTION.FORMATTED,
238
239
  actionSubject: ACTION_SUBJECT.TEXT,
239
240
  eventType: EVENT_TYPE.TRACK,
@@ -253,9 +254,9 @@ export const toggleCode = () => {
253
254
  return false;
254
255
  };
255
256
  };
256
- export const toggleCodeWithAnalytics = ({
257
+ export const toggleCodeWithAnalytics = editorAnalyticsAPI => ({
257
258
  inputMethod
258
- }) => withAnalytics({
259
+ }) => withAnalytics(editorAnalyticsAPI, {
259
260
  action: ACTION.FORMATTED,
260
261
  actionSubject: ACTION_SUBJECT.TEXT,
261
262
  eventType: EVENT_TYPE.TRACK,
@@ -288,8 +289,8 @@ const createInlineCodeFromTextInput = (from, to, text) => {
288
289
  return false;
289
290
  };
290
291
  };
291
- export const createInlineCodeFromTextInputWithAnalytics = (from, to, text) => {
292
- return withAnalytics({
292
+ export const createInlineCodeFromTextInputWithAnalytics = editorAnalyticsAPI => (from, to, text) => {
293
+ return withAnalytics(editorAnalyticsAPI, {
293
294
  action: ACTION.FORMATTED,
294
295
  actionSubject: ACTION_SUBJECT.TEXT,
295
296
  eventType: EVENT_TYPE.TRACK,
@@ -37,7 +37,10 @@ const textFormatting = (options = {}, api) => ({
37
37
  name: 'textFormatting',
38
38
  plugin: ({
39
39
  dispatch
40
- }) => textFormattingPlugin(dispatch)
40
+ }) => {
41
+ var _api$dependencies$ana;
42
+ return textFormattingPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
43
+ }
41
44
  }, {
42
45
  name: 'textFormattingCursor',
43
46
  plugin: () => textFormattingCursorPlugin
@@ -60,14 +63,17 @@ const textFormatting = (options = {}, api) => ({
60
63
  }, {
61
64
  name: 'textFormattingClearKeymap',
62
65
  plugin: () => {
63
- var _api$dependencies$ana;
64
- return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
66
+ var _api$dependencies$ana2;
67
+ return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
65
68
  }
66
69
  }, {
67
70
  name: 'textFormattingKeymap',
68
71
  plugin: ({
69
72
  schema
70
- }) => keymapPlugin(schema)
73
+ }) => {
74
+ var _api$dependencies$ana3;
75
+ return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
76
+ }
71
77
  }];
72
78
  },
73
79
  primaryToolbarComponent({
@@ -84,7 +90,7 @@ const textFormatting = (options = {}, api) => ({
84
90
  clearFormattingPluginState: clearFormattingPluginKey
85
91
  },
86
92
  render: () => {
87
- var _api$dependencies$ana2;
93
+ var _api$dependencies$ana4;
88
94
  return /*#__PURE__*/React.createElement(Toolbar, {
89
95
  editorState: editorView.state,
90
96
  popupsMountPoint: popupsMountPoint,
@@ -94,7 +100,7 @@ const textFormatting = (options = {}, api) => ({
94
100
  editorView: editorView,
95
101
  isToolbarDisabled: disabled,
96
102
  shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
97
- editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions
103
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions
98
104
  });
99
105
  }
100
106
  });
@@ -2,40 +2,40 @@ import * as keymaps from '../../../keymaps';
2
2
  import { keymap } from '../../../utils/keymap';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import * as commands from '../commands/text-formatting';
5
- export default function keymapPlugin(schema) {
5
+ export default function keymapPlugin(schema, editorAnalyticsAPI) {
6
6
  const list = {};
7
7
  if (schema.marks.strong) {
8
- keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics({
8
+ keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, commands.toggleStrongWithAnalytics(editorAnalyticsAPI)({
9
9
  inputMethod: INPUT_METHOD.SHORTCUT
10
10
  }), list);
11
11
  }
12
12
  if (schema.marks.em) {
13
- keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics({
13
+ keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, commands.toggleEmWithAnalytics(editorAnalyticsAPI)({
14
14
  inputMethod: INPUT_METHOD.SHORTCUT
15
15
  }), list);
16
16
  }
17
17
  if (schema.marks.code) {
18
- keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics({
18
+ keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, commands.toggleCodeWithAnalytics(editorAnalyticsAPI)({
19
19
  inputMethod: INPUT_METHOD.SHORTCUT
20
20
  }), list);
21
21
  }
22
22
  if (schema.marks.strike) {
23
- keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics({
23
+ keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)({
24
24
  inputMethod: INPUT_METHOD.SHORTCUT
25
25
  }), list);
26
26
  }
27
27
  if (schema.marks.subsup) {
28
- keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics({
28
+ keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)({
29
29
  inputMethod: INPUT_METHOD.SHORTCUT
30
30
  }), list);
31
31
  }
32
32
  if (schema.marks.subsup) {
33
- keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics({
33
+ keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)({
34
34
  inputMethod: INPUT_METHOD.SHORTCUT
35
35
  }), list);
36
36
  }
37
37
  if (schema.marks.underline) {
38
- keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics({
38
+ keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)({
39
39
  inputMethod: INPUT_METHOD.SHORTCUT
40
40
  }), list);
41
41
  }
@@ -8,7 +8,7 @@ import * as commands from '../commands/text-formatting';
8
8
  import { anyMarkActive } from '../utils';
9
9
  import { pluginKey } from './plugin-key';
10
10
  export { pluginKey };
11
- const getTextFormattingState = editorState => {
11
+ const getTextFormattingState = (editorState, editorAnalyticsAPI) => {
12
12
  const {
13
13
  em,
14
14
  code,
@@ -56,13 +56,13 @@ const getTextFormattingState = editorState => {
56
56
  }
57
57
  return state;
58
58
  };
59
- export const plugin = dispatch => new SafePlugin({
59
+ export const plugin = (dispatch, editorAnalyticsAPI) => new SafePlugin({
60
60
  state: {
61
61
  init(_config, state) {
62
- return getTextFormattingState(state);
62
+ return getTextFormattingState(state, editorAnalyticsAPI);
63
63
  },
64
64
  apply(_tr, pluginState, _oldState, newState) {
65
- const state = getTextFormattingState(newState);
65
+ const state = getTextFormattingState(newState, editorAnalyticsAPI);
66
66
  if (!shallowEqual(pluginState, state)) {
67
67
  dispatch(pluginKey, state);
68
68
  return state;
@@ -100,7 +100,7 @@ export const plugin = dispatch => new SafePlugin({
100
100
  }
101
101
  } = state;
102
102
  if (parentNodeType.allowsMarkType(schema.marks.code)) {
103
- return createInlineCodeFromTextInputWithAnalytics(from, to, text)(state, dispatch);
103
+ return createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI)(from, to, text)(state, dispatch);
104
104
  }
105
105
  return false;
106
106
  }
@@ -15,10 +15,10 @@ import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
15
15
  const withToolbarInputMethod = func => func({
16
16
  inputMethod: INPUT_METHOD.TOOLBAR
17
17
  });
18
- const IconButtons = {
18
+ const IconButtons = editorAnalyticsAPI => ({
19
19
  strong: {
20
20
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
21
- command: withToolbarInputMethod(commands.toggleStrongWithAnalytics),
21
+ command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
22
22
  message: toolbarMessages.bold,
23
23
  tooltipKeymap: toggleBold,
24
24
  component: () => jsx(BoldIcon, {
@@ -27,7 +27,7 @@ const IconButtons = {
27
27
  },
28
28
  em: {
29
29
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
30
- command: withToolbarInputMethod(commands.toggleEmWithAnalytics),
30
+ command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
31
31
  message: toolbarMessages.italic,
32
32
  tooltipKeymap: toggleItalic,
33
33
  component: () => jsx(ItalicIcon, {
@@ -35,38 +35,39 @@ const IconButtons = {
35
35
  })
36
36
  },
37
37
  underline: {
38
- command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics),
38
+ command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
39
39
  message: toolbarMessages.underline,
40
40
  tooltipKeymap: toggleUnderline
41
41
  },
42
42
  strike: {
43
- command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics),
43
+ command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
44
44
  message: toolbarMessages.strike,
45
45
  tooltipKeymap: toggleStrikethrough
46
46
  },
47
47
  code: {
48
- command: withToolbarInputMethod(commands.toggleCodeWithAnalytics),
48
+ command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
49
49
  message: toolbarMessages.code,
50
50
  tooltipKeymap: toggleCode
51
51
  },
52
52
  subscript: {
53
- command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics),
53
+ command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
54
54
  message: toolbarMessages.subscript,
55
55
  tooltipKeymap: toggleSubscript
56
56
  },
57
57
  superscript: {
58
- command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics),
58
+ command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
59
59
  message: toolbarMessages.superscript,
60
60
  tooltipKeymap: toggleSuperscript
61
61
  }
62
- };
62
+ });
63
63
  const getIcon = ({
64
64
  iconType,
65
65
  isDisabled,
66
66
  isActive,
67
- intl
67
+ intl,
68
+ editorAnalyticsAPI
68
69
  }) => {
69
- const icon = IconButtons[iconType];
70
+ const icon = IconButtons(editorAnalyticsAPI)[iconType];
70
71
  const content = intl.formatMessage(icon.message);
71
72
  const {
72
73
  tooltipKeymap
@@ -128,7 +129,7 @@ const buildMenuIconState = iconMark => ({
128
129
  hasSchemaMark
129
130
  };
130
131
  };
131
- const buildIcon = iconMark => {
132
+ const buildIcon = (iconMark, editorAnalyticsAPI) => {
132
133
  const getState = buildMenuIconState(iconMark);
133
134
  return ({
134
135
  schema,
@@ -150,19 +151,13 @@ const buildIcon = iconMark => {
150
151
  iconType: IconTypes[iconMark],
151
152
  isDisabled: isToolbarDisabled || isDisabled,
152
153
  isActive,
153
- intl
154
+ intl,
155
+ editorAnalyticsAPI
154
156
  }), [isToolbarDisabled, isDisabled, isActive, intl]);
155
157
  const shouldRenderIcon = hasSchemaMark && !isHidden;
156
158
  return useMemo(() => shouldRenderIcon ? iconComponent : null, [shouldRenderIcon, iconComponent]);
157
159
  };
158
160
  };
159
- const buildStrongIcon = buildIcon(IconTypes.strong);
160
- const buildEmIcon = buildIcon(IconTypes.em);
161
- const buildUnderlineIcon = buildIcon(IconTypes.underline);
162
- const buildStrikeIcon = buildIcon(IconTypes.strike);
163
- const buildCodeIcon = buildIcon(IconTypes.code);
164
- const buildSubscriptIcon = buildIcon(IconTypes.subscript);
165
- const buildSuperscriptIcon = buildIcon(IconTypes.superscript);
166
161
  const useTextFormattingPluginState = editorState => useMemo(() => {
167
162
  const pluginState = textFormattingPluginKey.getState(editorState);
168
163
 
@@ -172,7 +167,8 @@ const useTextFormattingPluginState = editorState => useMemo(() => {
172
167
  export const useFormattingIcons = ({
173
168
  isToolbarDisabled,
174
169
  editorState,
175
- intl
170
+ intl,
171
+ editorAnalyticsAPI
176
172
  }) => {
177
173
  const textFormattingPluginState = useTextFormattingPluginState(editorState);
178
174
  const {
@@ -184,6 +180,13 @@ export const useFormattingIcons = ({
184
180
  intl,
185
181
  isToolbarDisabled: Boolean(isToolbarDisabled)
186
182
  };
183
+ const buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI);
184
+ const buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI);
185
+ const buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI);
186
+ const buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI);
187
+ const buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI);
188
+ const buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI);
189
+ const buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI);
187
190
  const strongIcon = buildStrongIcon(props);
188
191
  const emIcon = buildEmIcon(props);
189
192
  const underlineIcon = buildUnderlineIcon(props);
@@ -31,7 +31,8 @@ const ToolbarFormatting = ({
31
31
  const defaultIcons = useFormattingIcons({
32
32
  editorState,
33
33
  intl,
34
- isToolbarDisabled
34
+ isToolbarDisabled,
35
+ editorAnalyticsAPI
35
36
  });
36
37
  const clearIcon = useClearIcon({
37
38
  editorState,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.3.5";
2
+ export const version = "187.4.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.3.5",
3
+ "version": "187.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,8 @@
1
1
  import { Selection } from 'prosemirror-state';
2
2
  import { applyMarkOnRange, toggleMark } from '../../../utils/commands';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { hasCode, markActive } from '../utils';
5
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
5
6
  export var moveRight = function moveRight() {
6
7
  return function (state, dispatch) {
7
8
  var code = state.schema.marks.code;
@@ -105,17 +106,19 @@ export var toggleEm = function toggleEm() {
105
106
  return false;
106
107
  };
107
108
  };
108
- export var toggleEmWithAnalytics = function toggleEmWithAnalytics(_ref3) {
109
- var inputMethod = _ref3.inputMethod;
110
- return withAnalytics({
111
- action: ACTION.FORMATTED,
112
- actionSubject: ACTION_SUBJECT.TEXT,
113
- eventType: EVENT_TYPE.TRACK,
114
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
115
- attributes: {
116
- inputMethod: inputMethod
117
- }
118
- })(toggleEm());
109
+ export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
110
+ return function (_ref3) {
111
+ var inputMethod = _ref3.inputMethod;
112
+ return withAnalytics(editorAnalyticsAPI, {
113
+ action: ACTION.FORMATTED,
114
+ actionSubject: ACTION_SUBJECT.TEXT,
115
+ eventType: EVENT_TYPE.TRACK,
116
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
117
+ attributes: {
118
+ inputMethod: inputMethod
119
+ }
120
+ })(toggleEm());
121
+ };
119
122
  };
120
123
  export var toggleStrike = function toggleStrike() {
121
124
  return function (state, dispatch) {
@@ -126,17 +129,19 @@ export var toggleStrike = function toggleStrike() {
126
129
  return false;
127
130
  };
128
131
  };
129
- export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(_ref4) {
130
- var inputMethod = _ref4.inputMethod;
131
- return withAnalytics({
132
- action: ACTION.FORMATTED,
133
- actionSubject: ACTION_SUBJECT.TEXT,
134
- eventType: EVENT_TYPE.TRACK,
135
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
136
- attributes: {
137
- inputMethod: inputMethod
138
- }
139
- })(toggleStrike());
132
+ export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
133
+ return function (_ref4) {
134
+ var inputMethod = _ref4.inputMethod;
135
+ return withAnalytics(editorAnalyticsAPI, {
136
+ action: ACTION.FORMATTED,
137
+ actionSubject: ACTION_SUBJECT.TEXT,
138
+ eventType: EVENT_TYPE.TRACK,
139
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
140
+ attributes: {
141
+ inputMethod: inputMethod
142
+ }
143
+ })(toggleStrike());
144
+ };
140
145
  };
141
146
  export var toggleStrong = function toggleStrong() {
142
147
  return function (state, dispatch) {
@@ -147,17 +152,19 @@ export var toggleStrong = function toggleStrong() {
147
152
  return false;
148
153
  };
149
154
  };
150
- export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(_ref5) {
151
- var inputMethod = _ref5.inputMethod;
152
- return withAnalytics({
153
- action: ACTION.FORMATTED,
154
- actionSubject: ACTION_SUBJECT.TEXT,
155
- eventType: EVENT_TYPE.TRACK,
156
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
157
- attributes: {
158
- inputMethod: inputMethod
159
- }
160
- })(toggleStrong());
155
+ export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
156
+ return function (_ref5) {
157
+ var inputMethod = _ref5.inputMethod;
158
+ return withAnalytics(editorAnalyticsAPI, {
159
+ action: ACTION.FORMATTED,
160
+ actionSubject: ACTION_SUBJECT.TEXT,
161
+ eventType: EVENT_TYPE.TRACK,
162
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
163
+ attributes: {
164
+ inputMethod: inputMethod
165
+ }
166
+ })(toggleStrong());
167
+ };
161
168
  };
162
169
  export var toggleUnderline = function toggleUnderline() {
163
170
  return function (state, dispatch) {
@@ -168,17 +175,19 @@ export var toggleUnderline = function toggleUnderline() {
168
175
  return false;
169
176
  };
170
177
  };
171
- export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(_ref6) {
172
- var inputMethod = _ref6.inputMethod;
173
- return withAnalytics({
174
- action: ACTION.FORMATTED,
175
- actionSubject: ACTION_SUBJECT.TEXT,
176
- eventType: EVENT_TYPE.TRACK,
177
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
178
- attributes: {
179
- inputMethod: inputMethod
180
- }
181
- })(toggleUnderline());
178
+ export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
179
+ return function (_ref6) {
180
+ var inputMethod = _ref6.inputMethod;
181
+ return withAnalytics(editorAnalyticsAPI, {
182
+ action: ACTION.FORMATTED,
183
+ actionSubject: ACTION_SUBJECT.TEXT,
184
+ eventType: EVENT_TYPE.TRACK,
185
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
186
+ attributes: {
187
+ inputMethod: inputMethod
188
+ }
189
+ })(toggleUnderline());
190
+ };
182
191
  };
183
192
  export var toggleSuperscript = function toggleSuperscript() {
184
193
  return function (state, dispatch) {
@@ -191,17 +200,19 @@ export var toggleSuperscript = function toggleSuperscript() {
191
200
  return false;
192
201
  };
193
202
  };
194
- export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(_ref7) {
195
- var inputMethod = _ref7.inputMethod;
196
- return withAnalytics({
197
- action: ACTION.FORMATTED,
198
- actionSubject: ACTION_SUBJECT.TEXT,
199
- eventType: EVENT_TYPE.TRACK,
200
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
201
- attributes: {
202
- inputMethod: inputMethod
203
- }
204
- })(toggleSuperscript());
203
+ export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
204
+ return function (_ref7) {
205
+ var inputMethod = _ref7.inputMethod;
206
+ return withAnalytics(editorAnalyticsAPI, {
207
+ action: ACTION.FORMATTED,
208
+ actionSubject: ACTION_SUBJECT.TEXT,
209
+ eventType: EVENT_TYPE.TRACK,
210
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
211
+ attributes: {
212
+ inputMethod: inputMethod
213
+ }
214
+ })(toggleSuperscript());
215
+ };
205
216
  };
206
217
  export var toggleSubscript = function toggleSubscript() {
207
218
  return function (state, dispatch) {
@@ -214,17 +225,19 @@ export var toggleSubscript = function toggleSubscript() {
214
225
  return false;
215
226
  };
216
227
  };
217
- export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(_ref8) {
218
- var inputMethod = _ref8.inputMethod;
219
- return withAnalytics({
220
- action: ACTION.FORMATTED,
221
- actionSubject: ACTION_SUBJECT.TEXT,
222
- eventType: EVENT_TYPE.TRACK,
223
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
224
- attributes: {
225
- inputMethod: inputMethod
226
- }
227
- })(toggleSubscript());
228
+ export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
229
+ return function (_ref8) {
230
+ var inputMethod = _ref8.inputMethod;
231
+ return withAnalytics(editorAnalyticsAPI, {
232
+ action: ACTION.FORMATTED,
233
+ actionSubject: ACTION_SUBJECT.TEXT,
234
+ eventType: EVENT_TYPE.TRACK,
235
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
236
+ attributes: {
237
+ inputMethod: inputMethod
238
+ }
239
+ })(toggleSubscript());
240
+ };
228
241
  };
229
242
  export var toggleCode = function toggleCode() {
230
243
  return function (state, dispatch) {
@@ -235,17 +248,19 @@ export var toggleCode = function toggleCode() {
235
248
  return false;
236
249
  };
237
250
  };
238
- export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(_ref9) {
239
- var inputMethod = _ref9.inputMethod;
240
- return withAnalytics({
241
- action: ACTION.FORMATTED,
242
- actionSubject: ACTION_SUBJECT.TEXT,
243
- eventType: EVENT_TYPE.TRACK,
244
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
245
- attributes: {
246
- inputMethod: inputMethod
247
- }
248
- })(toggleCode());
251
+ export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
252
+ return function (_ref9) {
253
+ var inputMethod = _ref9.inputMethod;
254
+ return withAnalytics(editorAnalyticsAPI, {
255
+ action: ACTION.FORMATTED,
256
+ actionSubject: ACTION_SUBJECT.TEXT,
257
+ eventType: EVENT_TYPE.TRACK,
258
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
259
+ attributes: {
260
+ inputMethod: inputMethod
261
+ }
262
+ })(toggleCode());
263
+ };
249
264
  };
250
265
  var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
251
266
  return function (state, dispatch) {
@@ -269,14 +284,16 @@ var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from,
269
284
  return false;
270
285
  };
271
286
  };
272
- export var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(from, to, text) {
273
- return withAnalytics({
274
- action: ACTION.FORMATTED,
275
- actionSubject: ACTION_SUBJECT.TEXT,
276
- eventType: EVENT_TYPE.TRACK,
277
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
278
- attributes: {
279
- inputMethod: INPUT_METHOD.FORMATTING
280
- }
281
- })(createInlineCodeFromTextInput(from, to, text));
287
+ export var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI) {
288
+ return function (from, to, text) {
289
+ return withAnalytics(editorAnalyticsAPI, {
290
+ action: ACTION.FORMATTED,
291
+ actionSubject: ACTION_SUBJECT.TEXT,
292
+ eventType: EVENT_TYPE.TRACK,
293
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
294
+ attributes: {
295
+ inputMethod: INPUT_METHOD.FORMATTING
296
+ }
297
+ })(createInlineCodeFromTextInput(from, to, text));
298
+ };
282
299
  };