@atlaskit/editor-core 187.10.8 → 187.11.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 (88) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/index.js +2 -94
  3. package/dist/cjs/plugins/help-dialog/ui/index.js +42 -42
  4. package/dist/cjs/plugins/paste/handlers.js +4 -6
  5. package/dist/cjs/plugins/text-formatting/actions.js +188 -0
  6. package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +1 -180
  7. package/dist/cjs/plugins/text-formatting/index.js +17 -0
  8. package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  9. package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +8 -8
  10. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -2
  11. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +16 -16
  12. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -8
  13. package/dist/cjs/plugins/text-formatting/utils.js +8 -36
  14. package/dist/cjs/ui/ContentStyles/index.js +8 -9
  15. package/dist/cjs/version-wrapper.js +1 -1
  16. package/dist/cjs/version.json +1 -1
  17. package/dist/es2019/index.js +0 -2
  18. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
  19. package/dist/es2019/plugins/paste/handlers.js +5 -7
  20. package/dist/es2019/plugins/text-formatting/actions.js +161 -0
  21. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -159
  22. package/dist/es2019/plugins/text-formatting/index.js +17 -0
  23. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  24. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
  25. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  26. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  27. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  28. package/dist/es2019/plugins/text-formatting/utils.js +1 -29
  29. package/dist/es2019/ui/ContentStyles/index.js +2 -3
  30. package/dist/es2019/version-wrapper.js +1 -1
  31. package/dist/es2019/version.json +1 -1
  32. package/dist/esm/index.js +0 -2
  33. package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
  34. package/dist/esm/plugins/paste/handlers.js +5 -7
  35. package/dist/esm/plugins/text-formatting/actions.js +168 -0
  36. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -166
  37. package/dist/esm/plugins/text-formatting/index.js +17 -0
  38. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  39. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
  40. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  41. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  42. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  43. package/dist/esm/plugins/text-formatting/utils.js +6 -33
  44. package/dist/esm/ui/ContentStyles/index.js +2 -3
  45. package/dist/esm/version-wrapper.js +1 -1
  46. package/dist/esm/version.json +1 -1
  47. package/dist/types/index.d.ts +6 -4
  48. package/dist/types/labs/next/presets/default.d.ts +78 -15
  49. package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  50. package/dist/types/plugins/paste/handlers.d.ts +1 -2
  51. package/dist/types/plugins/text-formatting/actions.d.ts +20 -0
  52. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  53. package/dist/types/plugins/text-formatting/index.d.ts +18 -2
  54. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  55. package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  56. package/dist/types/plugins/text-formatting/utils.d.ts +1 -5
  57. package/dist/types/types/editor-props.d.ts +1 -2
  58. package/dist/types/ui/ContentStyles/index.d.ts +1 -1
  59. package/dist/types-ts4.5/index.d.ts +6 -4
  60. package/dist/types-ts4.5/labs/next/presets/default.d.ts +78 -15
  61. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  62. package/dist/types-ts4.5/plugins/paste/handlers.d.ts +1 -2
  63. package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +20 -0
  64. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  65. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +18 -2
  66. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  67. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  68. package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +1 -5
  69. package/dist/types-ts4.5/types/editor-props.d.ts +1 -2
  70. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
  71. package/package.json +2 -2
  72. package/report.api.md +31 -145
  73. package/tmp/api-report-tmp.d.ts +30 -118
  74. package/dist/cjs/plugins/text-formatting/styles.js +0 -15
  75. package/dist/cjs/plugins/text-formatting/types.js +0 -5
  76. package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -95
  77. package/dist/es2019/plugins/text-formatting/styles.js +0 -5
  78. package/dist/es2019/plugins/text-formatting/types.js +0 -1
  79. package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  80. package/dist/esm/plugins/text-formatting/styles.js +0 -7
  81. package/dist/esm/plugins/text-formatting/types.js +0 -1
  82. package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  83. package/dist/types/plugins/text-formatting/styles.d.ts +0 -2
  84. package/dist/types/plugins/text-formatting/types.d.ts +0 -30
  85. package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
  86. package/dist/types-ts4.5/plugins/text-formatting/styles.d.ts +0 -2
  87. package/dist/types-ts4.5/plugins/text-formatting/types.d.ts +0 -30
  88. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
@@ -16,16 +16,16 @@ import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell,
16
16
  import { mapSlice } from '../../utils/slice';
17
17
  import { INPUT_METHOD } from '../analytics';
18
18
  import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
19
- import { linkifyContent } from '@atlaskit/editor-common/utils';
20
19
  import { runMacroAutoConvert } from '../macro';
21
20
  import { insertMediaAsMediaSingle } from '../media/utils/media-single';
22
- import { pluginKey as textFormattingPluginKey } from '../text-formatting/pm-plugins/main';
23
21
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
24
- import { isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
22
+ import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
25
23
  import { insertSliceForLists } from './edge-cases';
26
24
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
27
25
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
28
26
  import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
27
+ import { anyMarkActive } from '@atlaskit/editor-common/mark';
28
+
29
29
  // remove text attribute from mention for copy/paste (GDPR)
30
30
  export function handleMention(slice, schema) {
31
31
  return mapSlice(slice, function (node) {
@@ -86,8 +86,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChange
86
86
  }
87
87
  var filters = [linkifyContent(schema)];
88
88
  var selectionMarks = selection.$head.marks();
89
- var textFormattingState = textFormattingPluginKey.getState(state);
90
- if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeActive) // for codeMarks let's make sure mark is active
89
+ if (selection instanceof TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && hasOnlyNodesOfType(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || anyMarkActive(state, codeMark)) // check if there is a code mark anywhere in the selection
91
90
  ) {
92
91
  filters.push(applyTextMarksToSlice(schema, selection.$head.marks()));
93
92
  }
@@ -362,11 +361,10 @@ export function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
362
361
  if (selectionMarks.length === 0) {
363
362
  return false;
364
363
  }
365
- var textFormattingState = textFormattingPluginKey.getState(state);
366
364
 
367
365
  // special case for codeMark: will preserve mark only if codeMark is currently active
368
366
  // won't preserve mark if cursor is on the edge on the mark (namely inactive)
369
- if (codeMark.isInSet(selectionMarks) && !(textFormattingState !== null && textFormattingState !== void 0 && textFormattingState.codeActive)) {
367
+ if (codeMark.isInSet(selectionMarks) && !anyMarkActive(state, codeMark)) {
370
368
  return false;
371
369
  }
372
370
  var isPlainTextSlice = slice.content.childCount === 1 && slice.content.firstChild.type === paragraph && slice.content.firstChild.content.childCount === 1 && slice.content.firstChild.firstChild.type === text;
@@ -0,0 +1,168 @@
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
3
+ import { toggleMark } from '@atlaskit/editor-common/mark';
4
+ export var toggleEm = function toggleEm() {
5
+ return function (state, dispatch) {
6
+ var em = state.schema.marks.em;
7
+ if (em) {
8
+ return toggleMark(em)(state, dispatch);
9
+ }
10
+ return false;
11
+ };
12
+ };
13
+ export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
14
+ return function (_ref) {
15
+ var inputMethod = _ref.inputMethod;
16
+ return withAnalytics(editorAnalyticsAPI, {
17
+ action: ACTION.FORMATTED,
18
+ actionSubject: ACTION_SUBJECT.TEXT,
19
+ eventType: EVENT_TYPE.TRACK,
20
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
21
+ attributes: {
22
+ inputMethod: inputMethod
23
+ }
24
+ })(toggleEm());
25
+ };
26
+ };
27
+ export var toggleStrike = function toggleStrike() {
28
+ return function (state, dispatch) {
29
+ var strike = state.schema.marks.strike;
30
+ if (strike) {
31
+ return toggleMark(strike)(state, dispatch);
32
+ }
33
+ return false;
34
+ };
35
+ };
36
+ export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
37
+ return function (_ref2) {
38
+ var inputMethod = _ref2.inputMethod;
39
+ return withAnalytics(editorAnalyticsAPI, {
40
+ action: ACTION.FORMATTED,
41
+ actionSubject: ACTION_SUBJECT.TEXT,
42
+ eventType: EVENT_TYPE.TRACK,
43
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
44
+ attributes: {
45
+ inputMethod: inputMethod
46
+ }
47
+ })(toggleStrike());
48
+ };
49
+ };
50
+ export var toggleStrong = function toggleStrong() {
51
+ return function (state, dispatch) {
52
+ var strong = state.schema.marks.strong;
53
+ if (strong) {
54
+ return toggleMark(strong)(state, dispatch);
55
+ }
56
+ return false;
57
+ };
58
+ };
59
+ export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
60
+ return function (_ref3) {
61
+ var inputMethod = _ref3.inputMethod;
62
+ return withAnalytics(editorAnalyticsAPI, {
63
+ action: ACTION.FORMATTED,
64
+ actionSubject: ACTION_SUBJECT.TEXT,
65
+ eventType: EVENT_TYPE.TRACK,
66
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
67
+ attributes: {
68
+ inputMethod: inputMethod
69
+ }
70
+ })(toggleStrong());
71
+ };
72
+ };
73
+ export var toggleUnderline = function toggleUnderline() {
74
+ return function (state, dispatch) {
75
+ var underline = state.schema.marks.underline;
76
+ if (underline) {
77
+ return toggleMark(underline)(state, dispatch);
78
+ }
79
+ return false;
80
+ };
81
+ };
82
+ export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
83
+ return function (_ref4) {
84
+ var inputMethod = _ref4.inputMethod;
85
+ return withAnalytics(editorAnalyticsAPI, {
86
+ action: ACTION.FORMATTED,
87
+ actionSubject: ACTION_SUBJECT.TEXT,
88
+ eventType: EVENT_TYPE.TRACK,
89
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
90
+ attributes: {
91
+ inputMethod: inputMethod
92
+ }
93
+ })(toggleUnderline());
94
+ };
95
+ };
96
+ export var toggleSuperscript = function toggleSuperscript() {
97
+ return function (state, dispatch) {
98
+ var subsup = state.schema.marks.subsup;
99
+ if (subsup) {
100
+ return toggleMark(subsup, {
101
+ type: 'sup'
102
+ })(state, dispatch);
103
+ }
104
+ return false;
105
+ };
106
+ };
107
+ export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
108
+ return function (_ref5) {
109
+ var inputMethod = _ref5.inputMethod;
110
+ return withAnalytics(editorAnalyticsAPI, {
111
+ action: ACTION.FORMATTED,
112
+ actionSubject: ACTION_SUBJECT.TEXT,
113
+ eventType: EVENT_TYPE.TRACK,
114
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
115
+ attributes: {
116
+ inputMethod: inputMethod
117
+ }
118
+ })(toggleSuperscript());
119
+ };
120
+ };
121
+ export var toggleSubscript = function toggleSubscript() {
122
+ return function (state, dispatch) {
123
+ var subsup = state.schema.marks.subsup;
124
+ if (subsup) {
125
+ return toggleMark(subsup, {
126
+ type: 'sub'
127
+ })(state, dispatch);
128
+ }
129
+ return false;
130
+ };
131
+ };
132
+ export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
133
+ return function (_ref6) {
134
+ var inputMethod = _ref6.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_SUB,
140
+ attributes: {
141
+ inputMethod: inputMethod
142
+ }
143
+ })(toggleSubscript());
144
+ };
145
+ };
146
+ export var toggleCode = function toggleCode() {
147
+ return function (state, dispatch) {
148
+ var code = state.schema.marks.code;
149
+ if (code) {
150
+ return toggleMark(code)(state, dispatch);
151
+ }
152
+ return false;
153
+ };
154
+ };
155
+ export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
156
+ return function (_ref7) {
157
+ var inputMethod = _ref7.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_CODE,
163
+ attributes: {
164
+ inputMethod: inputMethod
165
+ }
166
+ })(toggleCode());
167
+ };
168
+ };
@@ -1,5 +1,5 @@
1
1
  import { Selection } from '@atlaskit/editor-prosemirror/state';
2
- import { applyMarkOnRange, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
3
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
5
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
@@ -97,171 +97,6 @@ export var moveLeft = function moveLeft() {
97
97
  return false;
98
98
  };
99
99
  };
100
- export var toggleEm = function toggleEm() {
101
- return function (state, dispatch) {
102
- var em = state.schema.marks.em;
103
- if (em) {
104
- return toggleMark(em)(state, dispatch);
105
- }
106
- return false;
107
- };
108
- };
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
- };
122
- };
123
- export var toggleStrike = function toggleStrike() {
124
- return function (state, dispatch) {
125
- var strike = state.schema.marks.strike;
126
- if (strike) {
127
- return toggleMark(strike)(state, dispatch);
128
- }
129
- return false;
130
- };
131
- };
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
- };
145
- };
146
- export var toggleStrong = function toggleStrong() {
147
- return function (state, dispatch) {
148
- var strong = state.schema.marks.strong;
149
- if (strong) {
150
- return toggleMark(strong)(state, dispatch);
151
- }
152
- return false;
153
- };
154
- };
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
- };
168
- };
169
- export var toggleUnderline = function toggleUnderline() {
170
- return function (state, dispatch) {
171
- var underline = state.schema.marks.underline;
172
- if (underline) {
173
- return toggleMark(underline)(state, dispatch);
174
- }
175
- return false;
176
- };
177
- };
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
- };
191
- };
192
- export var toggleSuperscript = function toggleSuperscript() {
193
- return function (state, dispatch) {
194
- var subsup = state.schema.marks.subsup;
195
- if (subsup) {
196
- return toggleMark(subsup, {
197
- type: 'sup'
198
- })(state, dispatch);
199
- }
200
- return false;
201
- };
202
- };
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
- };
216
- };
217
- export var toggleSubscript = function toggleSubscript() {
218
- return function (state, dispatch) {
219
- var subsup = state.schema.marks.subsup;
220
- if (subsup) {
221
- return toggleMark(subsup, {
222
- type: 'sub'
223
- })(state, dispatch);
224
- }
225
- return false;
226
- };
227
- };
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
- };
241
- };
242
- export var toggleCode = function toggleCode() {
243
- return function (state, dispatch) {
244
- var code = state.schema.marks.code;
245
- if (code) {
246
- return toggleMark(code)(state, dispatch);
247
- }
248
- return false;
249
- };
250
- };
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
- };
264
- };
265
100
  var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
266
101
  return function (state, dispatch) {
267
102
  if (state.selection.empty) {
@@ -9,6 +9,7 @@ import textFormattingInputRulePlugin from './pm-plugins/input-rule';
9
9
  import keymapPlugin from './pm-plugins/keymap';
10
10
  import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
11
11
  import Toolbar from './ui/Toolbar';
12
+ import { toggleSuperscript, toggleSuperscriptWithAnalytics, toggleSubscript, toggleSubscriptWithAnalytics, toggleStrike, toggleStrikeWithAnalytics, toggleCode, toggleCodeWithAnalytics, toggleUnderline, toggleUnderlineWithAnalytics, toggleEm, toggleEmWithAnalytics, toggleStrong, toggleStrongWithAnalytics } from './actions';
12
13
  var textFormatting = function textFormatting() {
13
14
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
15
  var api = arguments.length > 1 ? arguments[1] : undefined;
@@ -111,6 +112,22 @@ var textFormatting = function textFormatting() {
111
112
  });
112
113
  }
113
114
  });
115
+ },
116
+ actions: {
117
+ toggleSuperscript: toggleSuperscript,
118
+ toggleSuperscriptWithAnalytics: toggleSuperscriptWithAnalytics,
119
+ toggleSubscript: toggleSubscript,
120
+ toggleSubscriptWithAnalytics: toggleSubscriptWithAnalytics,
121
+ toggleStrike: toggleStrike,
122
+ toggleStrikeWithAnalytics: toggleStrikeWithAnalytics,
123
+ toggleCode: toggleCode,
124
+ toggleCodeWithAnalytics: toggleCodeWithAnalytics,
125
+ toggleUnderline: toggleUnderline,
126
+ toggleUnderlineWithAnalytics: toggleUnderlineWithAnalytics,
127
+ toggleEm: toggleEm,
128
+ toggleEmWithAnalytics: toggleEmWithAnalytics,
129
+ toggleStrong: toggleStrong,
130
+ toggleStrongWithAnalytics: toggleStrongWithAnalytics
114
131
  }
115
132
  };
116
133
  };
@@ -1,41 +1,41 @@
1
1
  import * as keymaps from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import * as commands from '../commands/text-formatting';
4
+ import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../actions';
5
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(editorAnalyticsAPI)({
8
+ keymaps.bindKeymapWithCommand(keymaps.toggleBold.common, 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(editorAnalyticsAPI)({
13
+ keymaps.bindKeymapWithCommand(keymaps.toggleItalic.common, 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(editorAnalyticsAPI)({
18
+ keymaps.bindKeymapWithCommand(keymaps.toggleCode.common, 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(editorAnalyticsAPI)({
23
+ keymaps.bindKeymapWithCommand(keymaps.toggleStrikethrough.common, 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(editorAnalyticsAPI)({
28
+ keymaps.bindKeymapWithCommand(keymaps.toggleSubscript.common, 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(editorAnalyticsAPI)({
33
+ keymaps.bindKeymapWithCommand(keymaps.toggleSuperscript.common, 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(editorAnalyticsAPI)({
38
+ keymaps.bindKeymapWithCommand(keymaps.toggleUnderline.common, toggleUnderlineWithAnalytics(editorAnalyticsAPI)({
39
39
  inputMethod: INPUT_METHOD.SHORTCUT
40
40
  }), list);
41
41
  }
@@ -6,7 +6,7 @@ import * as keymaps from '@atlaskit/editor-common/keymaps';
6
6
  import { shallowEqual } from '@atlaskit/editor-common/utils';
7
7
  import { createInlineCodeFromTextInputWithAnalytics } from '../commands/text-formatting';
8
8
  import * as commands from '../commands/text-formatting';
9
- import { anyMarkActive } from '../utils';
9
+ import { anyMarkActive } from '@atlaskit/editor-common/mark';
10
10
  import { pluginKey } from './plugin-key';
11
11
  export { pluginKey };
12
12
  var getTextFormattingState = function getTextFormattingState(editorState, editorAnalyticsAPI) {
@@ -2,7 +2,7 @@
2
2
  import { useCallback, useMemo } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
5
- import { toolbarMessages } from '../toolbar-messages';
5
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
6
6
  import { clearFormattingWithAnalytics } from '../../../commands/clear-formatting';
7
7
  import { pluginKey as clearFormattingPluginKey } from '../../../pm-plugins/clear-formatting';
8
8
  import { clearFormatting as clearFormattingKeymap, tooltip } from '@atlaskit/editor-common/keymaps';
@@ -6,8 +6,8 @@ import { jsx } from '@emotion/react';
6
6
  import BoldIcon from '@atlaskit/icon/glyph/editor/bold';
7
7
  import ItalicIcon from '@atlaskit/icon/glyph/editor/italic';
8
8
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
9
- import { toolbarMessages } from '../toolbar-messages';
10
- import * as commands from '../../../commands/text-formatting';
9
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
10
+ import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../actions';
11
11
  import { TOOLBAR_ACTION_SUBJECT_ID, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
12
12
  import { pluginKey as textFormattingPluginKey } from '../../../pm-plugins/plugin-key';
13
13
  import { toggleCode, toggleStrikethrough, toggleUnderline, tooltip, toggleBold, toggleItalic, toggleSubscript, toggleSuperscript, ToolTipContent, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
@@ -21,7 +21,7 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
21
21
  return {
22
22
  strong: {
23
23
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
24
- command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
24
+ command: withToolbarInputMethod(toggleStrongWithAnalytics(editorAnalyticsAPI)),
25
25
  message: toolbarMessages.bold,
26
26
  tooltipKeymap: toggleBold,
27
27
  component: function component() {
@@ -32,7 +32,7 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
32
32
  },
33
33
  em: {
34
34
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
35
- command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
35
+ command: withToolbarInputMethod(toggleEmWithAnalytics(editorAnalyticsAPI)),
36
36
  message: toolbarMessages.italic,
37
37
  tooltipKeymap: toggleItalic,
38
38
  component: function component() {
@@ -42,27 +42,27 @@ var IconButtons = function IconButtons(editorAnalyticsAPI) {
42
42
  }
43
43
  },
44
44
  underline: {
45
- command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
45
+ command: withToolbarInputMethod(toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
46
46
  message: toolbarMessages.underline,
47
47
  tooltipKeymap: toggleUnderline
48
48
  },
49
49
  strike: {
50
- command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
50
+ command: withToolbarInputMethod(toggleStrikeWithAnalytics(editorAnalyticsAPI)),
51
51
  message: toolbarMessages.strike,
52
52
  tooltipKeymap: toggleStrikethrough
53
53
  },
54
54
  code: {
55
- command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
55
+ command: withToolbarInputMethod(toggleCodeWithAnalytics(editorAnalyticsAPI)),
56
56
  message: toolbarMessages.code,
57
57
  tooltipKeymap: toggleCode
58
58
  },
59
59
  subscript: {
60
- command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
60
+ command: withToolbarInputMethod(toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
61
61
  message: toolbarMessages.subscript,
62
62
  tooltipKeymap: toggleSubscript
63
63
  },
64
64
  superscript: {
65
- command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
65
+ command: withToolbarInputMethod(toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
66
66
  message: toolbarMessages.superscript,
67
67
  tooltipKeymap: toggleSuperscript
68
68
  }
@@ -18,7 +18,7 @@ import { useResponsiveToolbarButtons, useResponsiveIconTypeMenu } from './hooks/
18
18
  import { SingleToolbarButtons } from './single-toolbar-buttons';
19
19
  import { MoreButton } from './more-button';
20
20
  import { FormattingTextDropdownMenu } from './dropdown-menu';
21
- import { toolbarMessages } from './toolbar-messages';
21
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
22
22
  import { compareItemsArrays, isArrayContainsContent } from '../../utils';
23
23
  import { Announcer } from '@atlaskit/editor-common/ui';
24
24
  import { usePreviousState } from '@atlaskit/editor-common/hooks';
@@ -1,4 +1,4 @@
1
- import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
1
+ import { anyMarkActive } from '@atlaskit/editor-common/mark';
2
2
  import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
3
3
  export var hasCode = function hasCode(state, pos) {
4
4
  var code = state.schema.marks.code;
@@ -30,37 +30,10 @@ export var markActive = function markActive(state, mark) {
30
30
  });
31
31
  return found;
32
32
  };
33
-
34
- /**
35
- * Determine if a mark of a specific type exists anywhere in the selection.
36
- */
37
- export var anyMarkActive = function anyMarkActive(state, markType) {
33
+ var blockStylingIsPresent = function blockStylingIsPresent(state) {
38
34
  var _state$selection2 = state.selection,
39
- $from = _state$selection2.$from,
40
35
  from = _state$selection2.from,
41
- to = _state$selection2.to,
42
- empty = _state$selection2.empty;
43
- if (empty) {
44
- return !!markType.isInSet(state.storedMarks || $from.marks());
45
- }
46
- var rangeHasMark = false;
47
- if (state.selection instanceof CellSelection) {
48
- state.selection.forEachCell(function (cell, cellPos) {
49
- var from = cellPos;
50
- var to = cellPos + cell.nodeSize;
51
- if (!rangeHasMark) {
52
- rangeHasMark = state.doc.rangeHasMark(from, to, markType);
53
- }
54
- });
55
- } else {
56
- rangeHasMark = state.doc.rangeHasMark(from, to, markType);
57
- }
58
- return rangeHasMark;
59
- };
60
- var blockStylingIsPresent = function blockStylingIsPresent(state) {
61
- var _state$selection3 = state.selection,
62
- from = _state$selection3.from,
63
- to = _state$selection3.to;
36
+ to = _state$selection2.to;
64
37
  var isBlockStyling = false;
65
38
  state.doc.nodesBetween(from, to, function (node) {
66
39
  if (FORMATTING_NODE_TYPES.indexOf(node.type.name) !== -1) {
@@ -74,9 +47,9 @@ var blockStylingIsPresent = function blockStylingIsPresent(state) {
74
47
  var marksArePresent = function marksArePresent(state) {
75
48
  var activeMarkTypes = FORMATTING_MARK_TYPES.filter(function (mark) {
76
49
  if (!!state.schema.marks[mark]) {
77
- var _state$selection4 = state.selection,
78
- $from = _state$selection4.$from,
79
- empty = _state$selection4.empty;
50
+ var _state$selection3 = state.selection,
51
+ $from = _state$selection3.$from,
52
+ empty = _state$selection3.empty;
80
53
  var marks = state.schema.marks;
81
54
  if (empty) {
82
55
  return !!marks[mark].isInSet(state.storedMarks || $from.marks());
@@ -20,7 +20,6 @@ import { panelStyles } from '../../plugins/panel/styles';
20
20
  import { fakeCursorStyles } from '../../plugins/fake-text-cursor/styles';
21
21
  import { mentionsStyles } from '../../plugins/mentions/styles';
22
22
  import { emojiStyles } from '../../plugins/emoji/styles';
23
- import { textFormattingStyles } from '../../plugins/text-formatting/styles';
24
23
  import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
25
24
  import { extensionStyles } from '../../plugins/extension/ui/styles';
26
25
  import { expandStyles } from '../../plugins/expand/ui/styles';
@@ -30,12 +29,12 @@ import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
30
29
  import { statusStyles } from '../../plugins/status/styles';
31
30
  import { dateStyles } from '../../plugins/date/styles';
32
31
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
33
- import { linkSharedStyle } from '@atlaskit/editor-common/styles';
32
+ import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
34
33
  export var linkStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n"])), linkSharedStyle);
35
34
  var contentStyles = function contentStyles(props) {
36
35
  return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), editorFontSize({
37
36
  theme: props.theme
38
- }), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, codeBlockStyles(props), blocktypeStyles(props), textFormattingStyles(props), textColorStyles, listsStyles, ruleStyles(props), mediaStyles, layoutStyles(props), telepointerStyle, gapCursorStyles, tableStyles(props), panelStyles(props), fakeCursorStyles, mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(props), findReplaceStyles, taskDecisionStyles, statusStyles, annotationSharedStyles(props), smartCardStyles, smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, ClassNames.FLOATING_TOOLBAR_COMPONENT);
37
+ }), whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, shadowSharedStyle, InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", placeholderTextStyles, placeholderStyles, codeBlockStyles(props), blocktypeStyles(props), codeMarkSharedStyles(props), textColorStyles, listsStyles, ruleStyles(props), mediaStyles, layoutStyles(props), telepointerStyle, gapCursorStyles, tableStyles(props), panelStyles(props), fakeCursorStyles, mentionsStyles, emojiStyles, tasksAndDecisionsStyles, gridStyles, linkStyles, blockMarksSharedStyles, dateSharedStyle, extensionStyles, expandStyles(props), findReplaceStyles, taskDecisionStyles, statusStyles, annotationSharedStyles(props), smartCardStyles, smartCardSharedStyles, dateStyles, embedCardStyles, unsupportedStyles, resizerStyles, ClassNames.FLOATING_TOOLBAR_COMPONENT);
39
38
  };
40
39
  export var createEditorContentStyle = function createEditorContentStyle(styles) {
41
40
  return /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.10.8";
2
+ export var version = "187.11.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.10.8",
3
+ "version": "187.11.0",
4
4
  "sideEffects": false
5
5
  }