@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
@@ -39,8 +39,9 @@ var textFormatting = function textFormatting() {
39
39
  return [{
40
40
  name: 'textFormatting',
41
41
  plugin: function plugin(_ref) {
42
+ var _api$dependencies$ana;
42
43
  var dispatch = _ref.dispatch;
43
- return textFormattingPlugin(dispatch);
44
+ 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);
44
45
  }
45
46
  }, {
46
47
  name: 'textFormattingCursor',
@@ -69,14 +70,15 @@ var textFormatting = function textFormatting() {
69
70
  }, {
70
71
  name: 'textFormattingClearKeymap',
71
72
  plugin: function plugin() {
72
- var _api$dependencies$ana;
73
- 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);
73
+ var _api$dependencies$ana2;
74
+ 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);
74
75
  }
75
76
  }, {
76
77
  name: 'textFormattingKeymap',
77
78
  plugin: function plugin(_ref5) {
79
+ var _api$dependencies$ana3;
78
80
  var schema = _ref5.schema;
79
- return keymapPlugin(schema);
81
+ 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);
80
82
  }
81
83
  }];
82
84
  },
@@ -93,7 +95,7 @@ var textFormatting = function textFormatting() {
93
95
  clearFormattingPluginState: clearFormattingPluginKey
94
96
  },
95
97
  render: function render() {
96
- var _api$dependencies$ana2;
98
+ var _api$dependencies$ana4;
97
99
  return /*#__PURE__*/React.createElement(Toolbar, {
98
100
  editorState: editorView.state,
99
101
  popupsMountPoint: popupsMountPoint,
@@ -103,7 +105,7 @@ var textFormatting = function textFormatting() {
103
105
  editorView: editorView,
104
106
  isToolbarDisabled: disabled,
105
107
  shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
106
- 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
108
+ 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
107
109
  });
108
110
  }
109
111
  });
@@ -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
  var 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
- var getTextFormattingState = function getTextFormattingState(editorState) {
11
+ var getTextFormattingState = function getTextFormattingState(editorState, editorAnalyticsAPI) {
12
12
  var _editorState$schema$m = editorState.schema.marks,
13
13
  em = _editorState$schema$m.em,
14
14
  code = _editorState$schema$m.code,
@@ -55,14 +55,14 @@ var getTextFormattingState = function getTextFormattingState(editorState) {
55
55
  }
56
56
  return state;
57
57
  };
58
- export var plugin = function plugin(dispatch) {
58
+ export var plugin = function plugin(dispatch, editorAnalyticsAPI) {
59
59
  return new SafePlugin({
60
60
  state: {
61
61
  init: function init(_config, state) {
62
- return getTextFormattingState(state);
62
+ return getTextFormattingState(state, editorAnalyticsAPI);
63
63
  },
64
64
  apply: function apply(_tr, pluginState, _oldState, newState) {
65
- var state = getTextFormattingState(newState);
65
+ var state = getTextFormattingState(newState, editorAnalyticsAPI);
66
66
  if (!shallowEqual(pluginState, state)) {
67
67
  dispatch(pluginKey, state);
68
68
  return state;
@@ -88,7 +88,7 @@ export var plugin = function plugin(dispatch) {
88
88
  var schema = state.schema,
89
89
  parentNodeType = state.selection.$from.parent.type;
90
90
  if (parentNodeType.allowsMarkType(schema.marks.code)) {
91
- return createInlineCodeFromTextInputWithAnalytics(from, to, text)(state, dispatch);
91
+ return createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI)(from, to, text)(state, dispatch);
92
92
  }
93
93
  return false;
94
94
  }
@@ -19,61 +19,64 @@ var withToolbarInputMethod = function withToolbarInputMethod(func) {
19
19
  inputMethod: INPUT_METHOD.TOOLBAR
20
20
  });
21
21
  };
22
- var IconButtons = {
23
- strong: {
24
- buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
25
- command: withToolbarInputMethod(commands.toggleStrongWithAnalytics),
26
- message: toolbarMessages.bold,
27
- tooltipKeymap: toggleBold,
28
- component: function component() {
29
- return jsx(BoldIcon, {
30
- label: ""
31
- });
32
- }
33
- },
34
- em: {
35
- buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
36
- command: withToolbarInputMethod(commands.toggleEmWithAnalytics),
37
- message: toolbarMessages.italic,
38
- tooltipKeymap: toggleItalic,
39
- component: function component() {
40
- return jsx(ItalicIcon, {
41
- label: ""
42
- });
22
+ var IconButtons = function IconButtons(editorAnalyticsAPI) {
23
+ return {
24
+ strong: {
25
+ buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
26
+ command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
27
+ message: toolbarMessages.bold,
28
+ tooltipKeymap: toggleBold,
29
+ component: function component() {
30
+ return jsx(BoldIcon, {
31
+ label: ""
32
+ });
33
+ }
34
+ },
35
+ em: {
36
+ buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
37
+ command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
38
+ message: toolbarMessages.italic,
39
+ tooltipKeymap: toggleItalic,
40
+ component: function component() {
41
+ return jsx(ItalicIcon, {
42
+ label: ""
43
+ });
44
+ }
45
+ },
46
+ underline: {
47
+ command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
48
+ message: toolbarMessages.underline,
49
+ tooltipKeymap: toggleUnderline
50
+ },
51
+ strike: {
52
+ command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
53
+ message: toolbarMessages.strike,
54
+ tooltipKeymap: toggleStrikethrough
55
+ },
56
+ code: {
57
+ command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
58
+ message: toolbarMessages.code,
59
+ tooltipKeymap: toggleCode
60
+ },
61
+ subscript: {
62
+ command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
63
+ message: toolbarMessages.subscript,
64
+ tooltipKeymap: toggleSubscript
65
+ },
66
+ superscript: {
67
+ command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
68
+ message: toolbarMessages.superscript,
69
+ tooltipKeymap: toggleSuperscript
43
70
  }
44
- },
45
- underline: {
46
- command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics),
47
- message: toolbarMessages.underline,
48
- tooltipKeymap: toggleUnderline
49
- },
50
- strike: {
51
- command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics),
52
- message: toolbarMessages.strike,
53
- tooltipKeymap: toggleStrikethrough
54
- },
55
- code: {
56
- command: withToolbarInputMethod(commands.toggleCodeWithAnalytics),
57
- message: toolbarMessages.code,
58
- tooltipKeymap: toggleCode
59
- },
60
- subscript: {
61
- command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics),
62
- message: toolbarMessages.subscript,
63
- tooltipKeymap: toggleSubscript
64
- },
65
- superscript: {
66
- command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics),
67
- message: toolbarMessages.superscript,
68
- tooltipKeymap: toggleSuperscript
69
- }
71
+ };
70
72
  };
71
73
  var getIcon = function getIcon(_ref) {
72
74
  var iconType = _ref.iconType,
73
75
  isDisabled = _ref.isDisabled,
74
76
  isActive = _ref.isActive,
75
- intl = _ref.intl;
76
- var icon = IconButtons[iconType];
77
+ intl = _ref.intl,
78
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI;
79
+ var icon = IconButtons(editorAnalyticsAPI)[iconType];
77
80
  var content = intl.formatMessage(icon.message);
78
81
  var tooltipKeymap = icon.tooltipKeymap;
79
82
  return {
@@ -126,7 +129,7 @@ var buildMenuIconState = function buildMenuIconState(iconMark) {
126
129
  };
127
130
  };
128
131
  };
129
- var buildIcon = function buildIcon(iconMark) {
132
+ var buildIcon = function buildIcon(iconMark, editorAnalyticsAPI) {
130
133
  var getState = buildMenuIconState(iconMark);
131
134
  return function (_ref3) {
132
135
  var schema = _ref3.schema,
@@ -146,7 +149,8 @@ var buildIcon = function buildIcon(iconMark) {
146
149
  iconType: IconTypes[iconMark],
147
150
  isDisabled: isToolbarDisabled || isDisabled,
148
151
  isActive: isActive,
149
- intl: intl
152
+ intl: intl,
153
+ editorAnalyticsAPI: editorAnalyticsAPI
150
154
  });
151
155
  }, [isToolbarDisabled, isDisabled, isActive, intl]);
152
156
  var shouldRenderIcon = hasSchemaMark && !isHidden;
@@ -155,13 +159,6 @@ var buildIcon = function buildIcon(iconMark) {
155
159
  }, [shouldRenderIcon, iconComponent]);
156
160
  };
157
161
  };
158
- var buildStrongIcon = buildIcon(IconTypes.strong);
159
- var buildEmIcon = buildIcon(IconTypes.em);
160
- var buildUnderlineIcon = buildIcon(IconTypes.underline);
161
- var buildStrikeIcon = buildIcon(IconTypes.strike);
162
- var buildCodeIcon = buildIcon(IconTypes.code);
163
- var buildSubscriptIcon = buildIcon(IconTypes.subscript);
164
- var buildSuperscriptIcon = buildIcon(IconTypes.superscript);
165
162
  var useTextFormattingPluginState = function useTextFormattingPluginState(editorState) {
166
163
  return useMemo(function () {
167
164
  var pluginState = textFormattingPluginKey.getState(editorState);
@@ -173,7 +170,8 @@ var useTextFormattingPluginState = function useTextFormattingPluginState(editorS
173
170
  export var useFormattingIcons = function useFormattingIcons(_ref4) {
174
171
  var isToolbarDisabled = _ref4.isToolbarDisabled,
175
172
  editorState = _ref4.editorState,
176
- intl = _ref4.intl;
173
+ intl = _ref4.intl,
174
+ editorAnalyticsAPI = _ref4.editorAnalyticsAPI;
177
175
  var textFormattingPluginState = useTextFormattingPluginState(editorState);
178
176
  var schema = editorState.schema;
179
177
  var props = {
@@ -182,6 +180,13 @@ export var useFormattingIcons = function useFormattingIcons(_ref4) {
182
180
  intl: intl,
183
181
  isToolbarDisabled: Boolean(isToolbarDisabled)
184
182
  };
183
+ var buildStrongIcon = buildIcon(IconTypes.strong, editorAnalyticsAPI);
184
+ var buildEmIcon = buildIcon(IconTypes.em, editorAnalyticsAPI);
185
+ var buildUnderlineIcon = buildIcon(IconTypes.underline, editorAnalyticsAPI);
186
+ var buildStrikeIcon = buildIcon(IconTypes.strike, editorAnalyticsAPI);
187
+ var buildCodeIcon = buildIcon(IconTypes.code, editorAnalyticsAPI);
188
+ var buildSubscriptIcon = buildIcon(IconTypes.subscript, editorAnalyticsAPI);
189
+ var buildSuperscriptIcon = buildIcon(IconTypes.superscript, editorAnalyticsAPI);
185
190
  var strongIcon = buildStrongIcon(props);
186
191
  var emIcon = buildEmIcon(props);
187
192
  var underlineIcon = buildUnderlineIcon(props);
@@ -44,7 +44,8 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
44
44
  var defaultIcons = useFormattingIcons({
45
45
  editorState: editorState,
46
46
  intl: intl,
47
- isToolbarDisabled: isToolbarDisabled
47
+ isToolbarDisabled: isToolbarDisabled,
48
+ editorAnalyticsAPI: editorAnalyticsAPI
48
49
  });
49
50
  var clearIcon = useClearIcon({
50
51
  editorState: editorState,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.3.5";
2
+ export var version = "187.4.0";
3
3
  export var nextMajorVersion = function 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,35 +1,35 @@
1
1
  import { Command } from '../../../types';
2
- import { INPUT_METHOD } from '../../analytics';
2
+ import { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  export declare const moveRight: () => Command;
4
4
  export declare const moveLeft: () => Command;
5
5
  export type InputMethodToolbar = INPUT_METHOD.TOOLBAR;
6
6
  export type InputMethodBasic = InputMethodToolbar | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING;
7
7
  export declare const toggleEm: () => Command;
8
- export declare const toggleEmWithAnalytics: ({ inputMethod, }: {
8
+ export declare const toggleEmWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
9
9
  inputMethod: InputMethodBasic;
10
10
  }) => Command;
11
11
  export declare const toggleStrike: () => Command;
12
- export declare const toggleStrikeWithAnalytics: ({ inputMethod, }: {
12
+ export declare const toggleStrikeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
13
13
  inputMethod: InputMethodBasic;
14
14
  }) => Command;
15
15
  export declare const toggleStrong: () => Command;
16
- export declare const toggleStrongWithAnalytics: ({ inputMethod, }: {
16
+ export declare const toggleStrongWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
17
17
  inputMethod: InputMethodBasic;
18
18
  }) => Command;
19
19
  export declare const toggleUnderline: () => Command;
20
- export declare const toggleUnderlineWithAnalytics: ({ inputMethod, }: {
20
+ export declare const toggleUnderlineWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
21
21
  inputMethod: InputMethodBasic;
22
22
  }) => Command;
23
23
  export declare const toggleSuperscript: () => Command;
24
- export declare const toggleSuperscriptWithAnalytics: ({ inputMethod, }: {
24
+ export declare const toggleSuperscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
25
25
  inputMethod: InputMethodBasic;
26
26
  }) => Command;
27
27
  export declare const toggleSubscript: () => Command;
28
- export declare const toggleSubscriptWithAnalytics: ({ inputMethod, }: {
28
+ export declare const toggleSubscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
29
29
  inputMethod: InputMethodBasic;
30
30
  }) => Command;
31
31
  export declare const toggleCode: () => Command;
32
- export declare const toggleCodeWithAnalytics: ({ inputMethod, }: {
32
+ export declare const toggleCodeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
33
33
  inputMethod: InputMethodBasic;
34
34
  }) => Command;
35
- export declare const createInlineCodeFromTextInputWithAnalytics: (from: number, to: number, text: string) => Command;
35
+ export declare const createInlineCodeFromTextInputWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (from: number, to: number, text: string) => Command;
@@ -1,3 +1,4 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- export default function keymapPlugin(schema: Schema): SafePlugin;
3
+ import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { Dispatch } from '../../../event-dispatcher';
3
3
  import { TextFormattingState } from '../types';
4
4
  import { pluginKey } from './plugin-key';
5
+ import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
6
  export { pluginKey };
6
7
  export type { TextFormattingState };
7
- export declare const plugin: (dispatch: Dispatch) => SafePlugin<TextFormattingState>;
8
+ export declare const plugin: (dispatch: Dispatch, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<TextFormattingState>;
@@ -1,6 +1,11 @@
1
- import { EditorState } from 'prosemirror-state';
2
- import { IconHookProps, MenuIconItem, IconTypes } from '../types';
3
- export declare const useFormattingIcons: ({ isToolbarDisabled, editorState, intl, }: IconHookProps) => Array<MenuIconItem | null>;
1
+ import type { EditorState } from 'prosemirror-state';
2
+ import type { IconHookProps, MenuIconItem } from '../types';
3
+ import { IconTypes } from '../types';
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
+ interface FormattingIconHookProps extends IconHookProps {
6
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
7
+ }
8
+ export declare const useFormattingIcons: ({ isToolbarDisabled, editorState, intl, editorAnalyticsAPI, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
4
9
  type Props = {
5
10
  editorState: EditorState;
6
11
  iconTypeList: IconTypes[];
@@ -1,35 +1,35 @@
1
1
  import { Command } from '../../../types';
2
- import { INPUT_METHOD } from '../../analytics';
2
+ import { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  export declare const moveRight: () => Command;
4
4
  export declare const moveLeft: () => Command;
5
5
  export type InputMethodToolbar = INPUT_METHOD.TOOLBAR;
6
6
  export type InputMethodBasic = InputMethodToolbar | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING;
7
7
  export declare const toggleEm: () => Command;
8
- export declare const toggleEmWithAnalytics: ({ inputMethod, }: {
8
+ export declare const toggleEmWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
9
9
  inputMethod: InputMethodBasic;
10
10
  }) => Command;
11
11
  export declare const toggleStrike: () => Command;
12
- export declare const toggleStrikeWithAnalytics: ({ inputMethod, }: {
12
+ export declare const toggleStrikeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
13
13
  inputMethod: InputMethodBasic;
14
14
  }) => Command;
15
15
  export declare const toggleStrong: () => Command;
16
- export declare const toggleStrongWithAnalytics: ({ inputMethod, }: {
16
+ export declare const toggleStrongWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
17
17
  inputMethod: InputMethodBasic;
18
18
  }) => Command;
19
19
  export declare const toggleUnderline: () => Command;
20
- export declare const toggleUnderlineWithAnalytics: ({ inputMethod, }: {
20
+ export declare const toggleUnderlineWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
21
21
  inputMethod: InputMethodBasic;
22
22
  }) => Command;
23
23
  export declare const toggleSuperscript: () => Command;
24
- export declare const toggleSuperscriptWithAnalytics: ({ inputMethod, }: {
24
+ export declare const toggleSuperscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
25
25
  inputMethod: InputMethodBasic;
26
26
  }) => Command;
27
27
  export declare const toggleSubscript: () => Command;
28
- export declare const toggleSubscriptWithAnalytics: ({ inputMethod, }: {
28
+ export declare const toggleSubscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
29
29
  inputMethod: InputMethodBasic;
30
30
  }) => Command;
31
31
  export declare const toggleCode: () => Command;
32
- export declare const toggleCodeWithAnalytics: ({ inputMethod, }: {
32
+ export declare const toggleCodeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
33
33
  inputMethod: InputMethodBasic;
34
34
  }) => Command;
35
- export declare const createInlineCodeFromTextInputWithAnalytics: (from: number, to: number, text: string) => Command;
35
+ export declare const createInlineCodeFromTextInputWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (from: number, to: number, text: string) => Command;
@@ -1,3 +1,4 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- export default function keymapPlugin(schema: Schema): SafePlugin;
3
+ import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { Dispatch } from '../../../event-dispatcher';
3
3
  import { TextFormattingState } from '../types';
4
4
  import { pluginKey } from './plugin-key';
5
+ import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
6
  export { pluginKey };
6
7
  export type { TextFormattingState };
7
- export declare const plugin: (dispatch: Dispatch) => SafePlugin<TextFormattingState>;
8
+ export declare const plugin: (dispatch: Dispatch, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin<TextFormattingState>;
@@ -1,6 +1,11 @@
1
- import { EditorState } from 'prosemirror-state';
2
- import { IconHookProps, MenuIconItem, IconTypes } from '../types';
3
- export declare const useFormattingIcons: ({ isToolbarDisabled, editorState, intl, }: IconHookProps) => Array<MenuIconItem | null>;
1
+ import type { EditorState } from 'prosemirror-state';
2
+ import type { IconHookProps, MenuIconItem } from '../types';
3
+ import { IconTypes } from '../types';
4
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
+ interface FormattingIconHookProps extends IconHookProps {
6
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
7
+ }
8
+ export declare const useFormattingIcons: ({ isToolbarDisabled, editorState, intl, editorAnalyticsAPI, }: FormattingIconHookProps) => Array<MenuIconItem | null>;
4
9
  type Props = {
5
10
  editorState: EditorState;
6
11
  iconTypeList: IconTypes[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.3.5",
3
+ "version": "187.4.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -75,7 +75,6 @@
75
75
  "@atlaskit/editor-tables": "^2.3.0",
76
76
  "@atlaskit/emoji": "^67.4.0",
77
77
  "@atlaskit/empty-state": "^7.6.0",
78
- "@atlaskit/enforce-peer-dependencies": "^1.0.1",
79
78
  "@atlaskit/form": "^8.11.0",
80
79
  "@atlaskit/icon": "^21.12.0",
81
80
  "@atlaskit/locale": "^2.5.0",
@@ -259,8 +258,5 @@
259
258
  "type": "boolean",
260
259
  "referenceOnly": "true"
261
260
  }
262
- },
263
- "scripts": {
264
- "postinstall": "npx enforce-peer-dependencies --internal-packages"
265
261
  }
266
262
  }
package/report.api.md CHANGED
@@ -2306,7 +2306,9 @@ function toggleBulletList(
2306
2306
  export const toggleCode: () => Command;
2307
2307
 
2308
2308
  // @public (undocumented)
2309
- export const toggleCodeWithAnalytics: ({
2309
+ export const toggleCodeWithAnalytics: (
2310
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2311
+ ) => ({
2310
2312
  inputMethod,
2311
2313
  }: {
2312
2314
  inputMethod: TextFormattingInputMethodBasic;
@@ -2316,7 +2318,9 @@ export const toggleCodeWithAnalytics: ({
2316
2318
  export const toggleEm: () => Command;
2317
2319
 
2318
2320
  // @public (undocumented)
2319
- export const toggleEmWithAnalytics: ({
2321
+ export const toggleEmWithAnalytics: (
2322
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2323
+ ) => ({
2320
2324
  inputMethod,
2321
2325
  }: {
2322
2326
  inputMethod: TextFormattingInputMethodBasic;
@@ -2332,7 +2336,9 @@ function toggleOrderedList(
2332
2336
  export const toggleStrike: () => Command;
2333
2337
 
2334
2338
  // @public (undocumented)
2335
- export const toggleStrikeWithAnalytics: ({
2339
+ export const toggleStrikeWithAnalytics: (
2340
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2341
+ ) => ({
2336
2342
  inputMethod,
2337
2343
  }: {
2338
2344
  inputMethod: TextFormattingInputMethodBasic;
@@ -2342,7 +2348,9 @@ export const toggleStrikeWithAnalytics: ({
2342
2348
  export const toggleStrong: () => Command;
2343
2349
 
2344
2350
  // @public (undocumented)
2345
- export const toggleStrongWithAnalytics: ({
2351
+ export const toggleStrongWithAnalytics: (
2352
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2353
+ ) => ({
2346
2354
  inputMethod,
2347
2355
  }: {
2348
2356
  inputMethod: TextFormattingInputMethodBasic;
@@ -2352,7 +2360,9 @@ export const toggleStrongWithAnalytics: ({
2352
2360
  export const toggleSubscript: () => Command;
2353
2361
 
2354
2362
  // @public (undocumented)
2355
- export const toggleSubscriptWithAnalytics: ({
2363
+ export const toggleSubscriptWithAnalytics: (
2364
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2365
+ ) => ({
2356
2366
  inputMethod,
2357
2367
  }: {
2358
2368
  inputMethod: TextFormattingInputMethodBasic;
@@ -2362,7 +2372,9 @@ export const toggleSubscriptWithAnalytics: ({
2362
2372
  export const toggleSuperscript: () => Command;
2363
2373
 
2364
2374
  // @public (undocumented)
2365
- export const toggleSuperscriptWithAnalytics: ({
2375
+ export const toggleSuperscriptWithAnalytics: (
2376
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2377
+ ) => ({
2366
2378
  inputMethod,
2367
2379
  }: {
2368
2380
  inputMethod: TextFormattingInputMethodBasic;
@@ -2372,7 +2384,9 @@ export const toggleSuperscriptWithAnalytics: ({
2372
2384
  export const toggleUnderline: () => Command;
2373
2385
 
2374
2386
  // @public (undocumented)
2375
- export const toggleUnderlineWithAnalytics: ({
2387
+ export const toggleUnderlineWithAnalytics: (
2388
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
2389
+ ) => ({
2376
2390
  inputMethod,
2377
2391
  }: {
2378
2392
  inputMethod: TextFormattingInputMethodBasic;
@@ -2069,7 +2069,7 @@ function toggleBulletList(view: EditorView, inputMethod?: ListInputMethod): bool
2069
2069
  export const toggleCode: () => Command;
2070
2070
 
2071
2071
  // @public (undocumented)
2072
- export const toggleCodeWithAnalytics: ({ inputMethod, }: {
2072
+ export const toggleCodeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2073
2073
  inputMethod: TextFormattingInputMethodBasic;
2074
2074
  }) => Command;
2075
2075
 
@@ -2077,7 +2077,7 @@ export const toggleCodeWithAnalytics: ({ inputMethod, }: {
2077
2077
  export const toggleEm: () => Command;
2078
2078
 
2079
2079
  // @public (undocumented)
2080
- export const toggleEmWithAnalytics: ({ inputMethod, }: {
2080
+ export const toggleEmWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2081
2081
  inputMethod: TextFormattingInputMethodBasic;
2082
2082
  }) => Command;
2083
2083
 
@@ -2088,7 +2088,7 @@ function toggleOrderedList(view: EditorView, inputMethod?: ListInputMethod): boo
2088
2088
  export const toggleStrike: () => Command;
2089
2089
 
2090
2090
  // @public (undocumented)
2091
- export const toggleStrikeWithAnalytics: ({ inputMethod, }: {
2091
+ export const toggleStrikeWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2092
2092
  inputMethod: TextFormattingInputMethodBasic;
2093
2093
  }) => Command;
2094
2094
 
@@ -2096,7 +2096,7 @@ export const toggleStrikeWithAnalytics: ({ inputMethod, }: {
2096
2096
  export const toggleStrong: () => Command;
2097
2097
 
2098
2098
  // @public (undocumented)
2099
- export const toggleStrongWithAnalytics: ({ inputMethod, }: {
2099
+ export const toggleStrongWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2100
2100
  inputMethod: TextFormattingInputMethodBasic;
2101
2101
  }) => Command;
2102
2102
 
@@ -2104,7 +2104,7 @@ export const toggleStrongWithAnalytics: ({ inputMethod, }: {
2104
2104
  export const toggleSubscript: () => Command;
2105
2105
 
2106
2106
  // @public (undocumented)
2107
- export const toggleSubscriptWithAnalytics: ({ inputMethod, }: {
2107
+ export const toggleSubscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2108
2108
  inputMethod: TextFormattingInputMethodBasic;
2109
2109
  }) => Command;
2110
2110
 
@@ -2112,7 +2112,7 @@ export const toggleSubscriptWithAnalytics: ({ inputMethod, }: {
2112
2112
  export const toggleSuperscript: () => Command;
2113
2113
 
2114
2114
  // @public (undocumented)
2115
- export const toggleSuperscriptWithAnalytics: ({ inputMethod, }: {
2115
+ export const toggleSuperscriptWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2116
2116
  inputMethod: TextFormattingInputMethodBasic;
2117
2117
  }) => Command;
2118
2118
 
@@ -2120,7 +2120,7 @@ export const toggleSuperscriptWithAnalytics: ({ inputMethod, }: {
2120
2120
  export const toggleUnderline: () => Command;
2121
2121
 
2122
2122
  // @public (undocumented)
2123
- export const toggleUnderlineWithAnalytics: ({ inputMethod, }: {
2123
+ export const toggleUnderlineWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ inputMethod }: {
2124
2124
  inputMethod: TextFormattingInputMethodBasic;
2125
2125
  }) => Command;
2126
2126