@atlaskit/editor-core 187.3.6 → 187.4.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 (39) 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/ui/ColorPickerButton/index.js +8 -3
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +18 -17
  12. package/dist/es2019/plugins/text-formatting/index.js +12 -6
  13. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  14. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +5 -5
  15. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +24 -21
  16. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +2 -1
  17. package/dist/es2019/ui/ColorPickerButton/index.js +13 -5
  18. package/dist/es2019/version-wrapper.js +1 -1
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +105 -88
  21. package/dist/esm/plugins/text-formatting/index.js +8 -6
  22. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  23. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +5 -5
  24. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +64 -59
  25. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +2 -1
  26. package/dist/esm/ui/ColorPickerButton/index.js +9 -4
  27. package/dist/esm/version-wrapper.js +1 -1
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
  30. package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
  31. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
  32. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
  33. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +9 -9
  34. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +2 -1
  35. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +2 -1
  36. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +8 -3
  37. package/package.json +3 -3
  38. package/report.api.md +21 -7
  39. 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 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
  };
@@ -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,
@@ -9,7 +9,7 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/ed
9
9
  import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
10
10
  import Button from '@atlaskit/button';
11
11
  import Tooltip from '@atlaskit/tooltip';
12
- import { DN50, N0, N60A } from '@atlaskit/theme/colors';
12
+ import { DN50, N0, N60A, N30A } from '@atlaskit/theme/colors';
13
13
  import { themed } from '@atlaskit/theme/components';
14
14
  import { borderRadius } from '@atlaskit/theme/constants';
15
15
  import ColorPalette from '../ColorPalette';
@@ -35,7 +35,6 @@ var colorPickerWrapper = function colorPickerWrapper(theme) {
35
35
  /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
36
36
 
37
37
  var ColorPickerButton = function ColorPickerButton(props) {
38
- var _props$size, _props$size2, _props$size3;
39
38
  var buttonRef = React.useRef(null);
40
39
  var _React$useState = React.useState(false),
41
40
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -162,8 +161,14 @@ var ColorPickerButton = function ColorPickerButton(props) {
162
161
  };
163
162
  var title = props.title || '';
164
163
  var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
165
- var buttonStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px 2px;\n }\n "])), "var(--ds-background-neutral, transparent)", /* If custom props size height, override the button base height property */
166
- !!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px');
164
+ var buttonStyle = function buttonStyle(theme) {
165
+ var _props$size, _props$size2, _props$size3;
166
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px 2px;\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
167
+ !!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', themed({
168
+ light: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")"),
169
+ dark: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")")
170
+ })(theme));
171
+ };
167
172
  return jsx("div", {
168
173
  css: colorPickerButtonWrapper
169
174
  }, jsx(Tooltip, {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.3.6";
2
+ export var version = "187.4.2";
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.6",
3
+ "version": "187.4.2",
4
4
  "sideEffects": false
5
5
  }