@atlaskit/editor-core 187.10.6 → 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 (105) hide show
  1. package/CHANGELOG.md +16 -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/media/nodeviews/mediaNodeUpdater.js +5 -5
  5. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +3 -3
  6. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +15 -6
  7. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +18 -16
  8. package/dist/cjs/plugins/media/utils/media-single.js +5 -9
  9. package/dist/cjs/plugins/paste/handlers.js +4 -6
  10. package/dist/cjs/plugins/text-formatting/actions.js +188 -0
  11. package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +1 -180
  12. package/dist/cjs/plugins/text-formatting/index.js +17 -0
  13. package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  14. package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +8 -8
  15. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +2 -2
  16. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +16 -16
  17. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +8 -8
  18. package/dist/cjs/plugins/text-formatting/utils.js +8 -36
  19. package/dist/cjs/ui/ContentStyles/index.js +8 -9
  20. package/dist/cjs/version-wrapper.js +1 -1
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/index.js +0 -2
  23. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
  24. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  25. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +1 -1
  26. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +13 -4
  27. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +11 -10
  28. package/dist/es2019/plugins/media/utils/media-single.js +6 -7
  29. package/dist/es2019/plugins/paste/handlers.js +5 -7
  30. package/dist/es2019/plugins/text-formatting/actions.js +161 -0
  31. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -159
  32. package/dist/es2019/plugins/text-formatting/index.js +17 -0
  33. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  34. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
  35. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  36. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  37. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  38. package/dist/es2019/plugins/text-formatting/utils.js +1 -29
  39. package/dist/es2019/ui/ContentStyles/index.js +2 -3
  40. package/dist/es2019/version-wrapper.js +1 -1
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/index.js +0 -2
  43. package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
  44. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  45. package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +1 -1
  46. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +13 -4
  47. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +21 -19
  48. package/dist/esm/plugins/media/utils/media-single.js +6 -10
  49. package/dist/esm/plugins/paste/handlers.js +5 -7
  50. package/dist/esm/plugins/text-formatting/actions.js +168 -0
  51. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -166
  52. package/dist/esm/plugins/text-formatting/index.js +17 -0
  53. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  54. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
  55. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  56. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  57. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  58. package/dist/esm/plugins/text-formatting/utils.js +6 -33
  59. package/dist/esm/ui/ContentStyles/index.js +2 -3
  60. package/dist/esm/version-wrapper.js +1 -1
  61. package/dist/esm/version.json +1 -1
  62. package/dist/types/index.d.ts +6 -4
  63. package/dist/types/labs/next/presets/default.d.ts +78 -15
  64. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -2
  65. package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  66. package/dist/types/plugins/paste/handlers.d.ts +1 -2
  67. package/dist/types/plugins/text-formatting/actions.d.ts +20 -0
  68. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  69. package/dist/types/plugins/text-formatting/index.d.ts +18 -2
  70. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  71. package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  72. package/dist/types/plugins/text-formatting/utils.d.ts +1 -5
  73. package/dist/types/types/editor-props.d.ts +1 -2
  74. package/dist/types/ui/ContentStyles/index.d.ts +1 -1
  75. package/dist/types-ts4.5/index.d.ts +6 -4
  76. package/dist/types-ts4.5/labs/next/presets/default.d.ts +78 -15
  77. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeUpdater.d.ts +1 -2
  78. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  79. package/dist/types-ts4.5/plugins/paste/handlers.d.ts +1 -2
  80. package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +20 -0
  81. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  82. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +18 -2
  83. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  84. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  85. package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +1 -5
  86. package/dist/types-ts4.5/types/editor-props.d.ts +1 -2
  87. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
  88. package/package.json +3 -3
  89. package/report.api.md +31 -145
  90. package/tmp/api-report-tmp.d.ts +30 -118
  91. package/dist/cjs/plugins/text-formatting/styles.js +0 -15
  92. package/dist/cjs/plugins/text-formatting/types.js +0 -5
  93. package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -95
  94. package/dist/es2019/plugins/text-formatting/styles.js +0 -5
  95. package/dist/es2019/plugins/text-formatting/types.js +0 -1
  96. package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  97. package/dist/esm/plugins/text-formatting/styles.js +0 -7
  98. package/dist/esm/plugins/text-formatting/types.js +0 -1
  99. package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  100. package/dist/types/plugins/text-formatting/styles.d.ts +0 -2
  101. package/dist/types/plugins/text-formatting/types.d.ts +0 -30
  102. package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
  103. package/dist/types-ts4.5/plugins/text-formatting/styles.d.ts +0 -2
  104. package/dist/types-ts4.5/plugins/text-formatting/types.d.ts +0 -30
  105. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
@@ -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';
@@ -107,164 +107,6 @@ export const moveLeft = () => {
107
107
  return false;
108
108
  };
109
109
  };
110
- export const toggleEm = () => {
111
- return (state, dispatch) => {
112
- const {
113
- em
114
- } = state.schema.marks;
115
- if (em) {
116
- return toggleMark(em)(state, dispatch);
117
- }
118
- return false;
119
- };
120
- };
121
- export const toggleEmWithAnalytics = editorAnalyticsAPI => ({
122
- inputMethod
123
- }) => withAnalytics(editorAnalyticsAPI, {
124
- action: ACTION.FORMATTED,
125
- actionSubject: ACTION_SUBJECT.TEXT,
126
- eventType: EVENT_TYPE.TRACK,
127
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
128
- attributes: {
129
- inputMethod
130
- }
131
- })(toggleEm());
132
- export const toggleStrike = () => {
133
- return (state, dispatch) => {
134
- const {
135
- strike
136
- } = state.schema.marks;
137
- if (strike) {
138
- return toggleMark(strike)(state, dispatch);
139
- }
140
- return false;
141
- };
142
- };
143
- export const toggleStrikeWithAnalytics = editorAnalyticsAPI => ({
144
- inputMethod
145
- }) => withAnalytics(editorAnalyticsAPI, {
146
- action: ACTION.FORMATTED,
147
- actionSubject: ACTION_SUBJECT.TEXT,
148
- eventType: EVENT_TYPE.TRACK,
149
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
150
- attributes: {
151
- inputMethod
152
- }
153
- })(toggleStrike());
154
- export const toggleStrong = () => {
155
- return (state, dispatch) => {
156
- const {
157
- strong
158
- } = state.schema.marks;
159
- if (strong) {
160
- return toggleMark(strong)(state, dispatch);
161
- }
162
- return false;
163
- };
164
- };
165
- export const toggleStrongWithAnalytics = editorAnalyticsAPI => ({
166
- inputMethod
167
- }) => withAnalytics(editorAnalyticsAPI, {
168
- action: ACTION.FORMATTED,
169
- actionSubject: ACTION_SUBJECT.TEXT,
170
- eventType: EVENT_TYPE.TRACK,
171
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
172
- attributes: {
173
- inputMethod
174
- }
175
- })(toggleStrong());
176
- export const toggleUnderline = () => {
177
- return (state, dispatch) => {
178
- const {
179
- underline
180
- } = state.schema.marks;
181
- if (underline) {
182
- return toggleMark(underline)(state, dispatch);
183
- }
184
- return false;
185
- };
186
- };
187
- export const toggleUnderlineWithAnalytics = editorAnalyticsAPI => ({
188
- inputMethod
189
- }) => withAnalytics(editorAnalyticsAPI, {
190
- action: ACTION.FORMATTED,
191
- actionSubject: ACTION_SUBJECT.TEXT,
192
- eventType: EVENT_TYPE.TRACK,
193
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
194
- attributes: {
195
- inputMethod
196
- }
197
- })(toggleUnderline());
198
- export const toggleSuperscript = () => {
199
- return (state, dispatch) => {
200
- const {
201
- subsup
202
- } = state.schema.marks;
203
- if (subsup) {
204
- return toggleMark(subsup, {
205
- type: 'sup'
206
- })(state, dispatch);
207
- }
208
- return false;
209
- };
210
- };
211
- export const toggleSuperscriptWithAnalytics = editorAnalyticsAPI => ({
212
- inputMethod
213
- }) => withAnalytics(editorAnalyticsAPI, {
214
- action: ACTION.FORMATTED,
215
- actionSubject: ACTION_SUBJECT.TEXT,
216
- eventType: EVENT_TYPE.TRACK,
217
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
218
- attributes: {
219
- inputMethod
220
- }
221
- })(toggleSuperscript());
222
- export const toggleSubscript = () => {
223
- return (state, dispatch) => {
224
- const {
225
- subsup
226
- } = state.schema.marks;
227
- if (subsup) {
228
- return toggleMark(subsup, {
229
- type: 'sub'
230
- })(state, dispatch);
231
- }
232
- return false;
233
- };
234
- };
235
- export const toggleSubscriptWithAnalytics = editorAnalyticsAPI => ({
236
- inputMethod
237
- }) => withAnalytics(editorAnalyticsAPI, {
238
- action: ACTION.FORMATTED,
239
- actionSubject: ACTION_SUBJECT.TEXT,
240
- eventType: EVENT_TYPE.TRACK,
241
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
242
- attributes: {
243
- inputMethod
244
- }
245
- })(toggleSubscript());
246
- export const toggleCode = () => {
247
- return (state, dispatch) => {
248
- const {
249
- code
250
- } = state.schema.marks;
251
- if (code) {
252
- return toggleMark(code)(state, dispatch);
253
- }
254
- return false;
255
- };
256
- };
257
- export const toggleCodeWithAnalytics = editorAnalyticsAPI => ({
258
- inputMethod
259
- }) => withAnalytics(editorAnalyticsAPI, {
260
- action: ACTION.FORMATTED,
261
- actionSubject: ACTION_SUBJECT.TEXT,
262
- eventType: EVENT_TYPE.TRACK,
263
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
264
- attributes: {
265
- inputMethod
266
- }
267
- })(toggleCode());
268
110
  const createInlineCodeFromTextInput = (from, to, text) => {
269
111
  return (state, dispatch) => {
270
112
  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
  const textFormatting = (options = {}, api) => ({
13
14
  name: 'textFormatting',
14
15
  marks() {
@@ -109,6 +110,22 @@ const textFormatting = (options = {}, api) => ({
109
110
  });
110
111
  }
111
112
  });
113
+ },
114
+ actions: {
115
+ toggleSuperscript,
116
+ toggleSuperscriptWithAnalytics,
117
+ toggleSubscript,
118
+ toggleSubscriptWithAnalytics,
119
+ toggleStrike,
120
+ toggleStrikeWithAnalytics,
121
+ toggleCode,
122
+ toggleCodeWithAnalytics,
123
+ toggleUnderline,
124
+ toggleUnderlineWithAnalytics,
125
+ toggleEm,
126
+ toggleEmWithAnalytics,
127
+ toggleStrong,
128
+ toggleStrongWithAnalytics
112
129
  }
113
130
  });
114
131
  export default textFormatting;
@@ -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
  const 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
  const 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';
@@ -4,8 +4,8 @@ import { jsx } from '@emotion/react';
4
4
  import BoldIcon from '@atlaskit/icon/glyph/editor/bold';
5
5
  import ItalicIcon from '@atlaskit/icon/glyph/editor/italic';
6
6
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
7
- import { toolbarMessages } from '../toolbar-messages';
8
- import * as commands from '../../../commands/text-formatting';
7
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
8
+ import { toggleStrongWithAnalytics, toggleEmWithAnalytics, toggleCodeWithAnalytics, toggleStrikeWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from '../../../actions';
9
9
  import { TOOLBAR_ACTION_SUBJECT_ID, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
10
  import { pluginKey as textFormattingPluginKey } from '../../../pm-plugins/plugin-key';
11
11
  import { toggleCode, toggleStrikethrough, toggleUnderline, tooltip, toggleBold, toggleItalic, toggleSubscript, toggleSuperscript, ToolTipContent, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
@@ -16,7 +16,7 @@ const withToolbarInputMethod = func => func({
16
16
  const IconButtons = editorAnalyticsAPI => ({
17
17
  strong: {
18
18
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_STRONG,
19
- command: withToolbarInputMethod(commands.toggleStrongWithAnalytics(editorAnalyticsAPI)),
19
+ command: withToolbarInputMethod(toggleStrongWithAnalytics(editorAnalyticsAPI)),
20
20
  message: toolbarMessages.bold,
21
21
  tooltipKeymap: toggleBold,
22
22
  component: () => jsx(BoldIcon, {
@@ -25,7 +25,7 @@ const IconButtons = editorAnalyticsAPI => ({
25
25
  },
26
26
  em: {
27
27
  buttonId: TOOLBAR_ACTION_SUBJECT_ID.TEXT_FORMATTING_ITALIC,
28
- command: withToolbarInputMethod(commands.toggleEmWithAnalytics(editorAnalyticsAPI)),
28
+ command: withToolbarInputMethod(toggleEmWithAnalytics(editorAnalyticsAPI)),
29
29
  message: toolbarMessages.italic,
30
30
  tooltipKeymap: toggleItalic,
31
31
  component: () => jsx(ItalicIcon, {
@@ -33,27 +33,27 @@ const IconButtons = editorAnalyticsAPI => ({
33
33
  })
34
34
  },
35
35
  underline: {
36
- command: withToolbarInputMethod(commands.toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
36
+ command: withToolbarInputMethod(toggleUnderlineWithAnalytics(editorAnalyticsAPI)),
37
37
  message: toolbarMessages.underline,
38
38
  tooltipKeymap: toggleUnderline
39
39
  },
40
40
  strike: {
41
- command: withToolbarInputMethod(commands.toggleStrikeWithAnalytics(editorAnalyticsAPI)),
41
+ command: withToolbarInputMethod(toggleStrikeWithAnalytics(editorAnalyticsAPI)),
42
42
  message: toolbarMessages.strike,
43
43
  tooltipKeymap: toggleStrikethrough
44
44
  },
45
45
  code: {
46
- command: withToolbarInputMethod(commands.toggleCodeWithAnalytics(editorAnalyticsAPI)),
46
+ command: withToolbarInputMethod(toggleCodeWithAnalytics(editorAnalyticsAPI)),
47
47
  message: toolbarMessages.code,
48
48
  tooltipKeymap: toggleCode
49
49
  },
50
50
  subscript: {
51
- command: withToolbarInputMethod(commands.toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
51
+ command: withToolbarInputMethod(toggleSubscriptWithAnalytics(editorAnalyticsAPI)),
52
52
  message: toolbarMessages.subscript,
53
53
  tooltipKeymap: toggleSubscript
54
54
  },
55
55
  superscript: {
56
- command: withToolbarInputMethod(commands.toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
56
+ command: withToolbarInputMethod(toggleSuperscriptWithAnalytics(editorAnalyticsAPI)),
57
57
  message: toolbarMessages.superscript,
58
58
  tooltipKeymap: toggleSuperscript
59
59
  }
@@ -9,7 +9,7 @@ import { useResponsiveToolbarButtons, useResponsiveIconTypeMenu } from './hooks/
9
9
  import { SingleToolbarButtons } from './single-toolbar-buttons';
10
10
  import { MoreButton } from './more-button';
11
11
  import { FormattingTextDropdownMenu } from './dropdown-menu';
12
- import { toolbarMessages } from './toolbar-messages';
12
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
13
13
  import { compareItemsArrays, isArrayContainsContent } from '../../utils';
14
14
  import { Announcer } from '@atlaskit/editor-common/ui';
15
15
  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 const hasCode = (state, pos) => {
4
4
  const {
@@ -31,34 +31,6 @@ export const markActive = (state, mark) => {
31
31
  });
32
32
  return found;
33
33
  };
34
-
35
- /**
36
- * Determine if a mark of a specific type exists anywhere in the selection.
37
- */
38
- export const anyMarkActive = (state, markType) => {
39
- const {
40
- $from,
41
- from,
42
- to,
43
- empty
44
- } = state.selection;
45
- if (empty) {
46
- return !!markType.isInSet(state.storedMarks || $from.marks());
47
- }
48
- let rangeHasMark = false;
49
- if (state.selection instanceof CellSelection) {
50
- state.selection.forEachCell((cell, cellPos) => {
51
- const from = cellPos;
52
- const to = cellPos + cell.nodeSize;
53
- if (!rangeHasMark) {
54
- rangeHasMark = state.doc.rangeHasMark(from, to, markType);
55
- }
56
- });
57
- } else {
58
- rangeHasMark = state.doc.rangeHasMark(from, to, markType);
59
- }
60
- return rangeHasMark;
61
- };
62
34
  const blockStylingIsPresent = state => {
63
35
  let {
64
36
  from,
@@ -18,7 +18,6 @@ import { panelStyles } from '../../plugins/panel/styles';
18
18
  import { fakeCursorStyles } from '../../plugins/fake-text-cursor/styles';
19
19
  import { mentionsStyles } from '../../plugins/mentions/styles';
20
20
  import { emojiStyles } from '../../plugins/emoji/styles';
21
- import { textFormattingStyles } from '../../plugins/text-formatting/styles';
22
21
  import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
23
22
  import { extensionStyles } from '../../plugins/extension/ui/styles';
24
23
  import { expandStyles } from '../../plugins/expand/ui/styles';
@@ -28,7 +27,7 @@ import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
28
27
  import { statusStyles } from '../../plugins/status/styles';
29
28
  import { dateStyles } from '../../plugins/date/styles';
30
29
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
31
- import { linkSharedStyle } from '@atlaskit/editor-common/styles';
30
+ import { linkSharedStyle, codeMarkSharedStyles } from '@atlaskit/editor-common/styles';
32
31
  export const linkStyles = css`
33
32
  .ProseMirror {
34
33
  ${linkSharedStyle}
@@ -74,7 +73,7 @@ const contentStyles = props => css`
74
73
  ${codeBlockStyles(props)}
75
74
 
76
75
  ${blocktypeStyles(props)}
77
- ${textFormattingStyles(props)}
76
+ ${codeMarkSharedStyles(props)}
78
77
  ${textColorStyles}
79
78
  ${listsStyles}
80
79
  ${ruleStyles(props)}
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.10.6";
2
+ export const version = "187.11.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.10.6",
3
+ "version": "187.11.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -17,13 +17,11 @@ export { AnnotationUpdateEmitter } from './plugins/annotation';
17
17
  // Used in mobile bridge
18
18
  export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
19
19
  export { mentionPluginKey } from './plugins/mentions';
20
- export { pluginKey as textFormattingStateKey } from './plugins/text-formatting/pm-plugins/main';
21
20
  export { textColorPluginKey } from './plugins/text-color';
22
21
  export { changeColor } from './plugins/text-color/commands/change-color';
23
22
  export { insertHorizontalRule } from './plugins/rule/commands';
24
23
  export { blockPluginStateKey } from './plugins';
25
24
  export { pluginKey as listStateKey } from './plugins/list/pm-plugins/main';
26
- export { toggleSuperscript, toggleSuperscriptWithAnalytics, toggleSubscript, toggleSubscriptWithAnalytics, toggleStrike, toggleStrikeWithAnalytics, toggleCode, toggleCodeWithAnalytics, toggleUnderline, toggleUnderlineWithAnalytics, toggleEm, toggleEmWithAnalytics, toggleStrong, toggleStrongWithAnalytics } from './plugins/text-formatting/commands/text-formatting';
27
25
  export { subscribeToToolbarAndPickerUpdates } from './plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates';
28
26
  export { subscribeTypeAheadUpdates } from './plugins/view-update-subscription/subscribe/type-ahead-updates';
29
27
  export { insertBlockType, insertBlockTypesWithAnalytics, setBlockType, setBlockTypeWithAnalytics } from './plugins/block-type/commands';
@@ -19,7 +19,7 @@ import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog
19
19
  import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
20
20
  import * as keymaps from '../../../keymaps';
21
21
  import ToolbarButton from '../../../ui/ToolbarButton';
22
- import { toolbarMessages } from '../../text-formatting/ui/Toolbar/toolbar-messages';
22
+ import { toolbarMessages } from '@atlaskit/editor-common/messages';
23
23
  import { messages as listMessages } from '../../list/messages';
24
24
  import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
25
25
  import { messages as blockTypeMessages } from '../../block-type/messages';
@@ -4,7 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import uuidV4 from 'uuid/v4';
7
- import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
7
+ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
8
8
  import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
9
9
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
10
10
  import { replaceExternalMedia, updateAllMediaSingleNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaSingleNodeAttrs } from '../commands/helpers';
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
11
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
12
- import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
12
+ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
13
13
  import React from 'react';
14
14
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
15
15
  import MediaNode from './media';
@@ -16,7 +16,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
16
16
  import { jsx } from '@emotion/react';
17
17
  import React, { Component } from 'react';
18
18
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
19
- import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
19
+ import { MediaSingle } from '@atlaskit/editor-common/ui';
20
20
  import { browser, floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
21
21
  import { isNodeSelectedOrInRange } from '../../../utils/nodes';
22
22
  import { setNodeSelection, setTextSelection } from '../../../utils';
@@ -35,7 +35,7 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
35
35
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
36
36
  import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
37
37
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
38
- import { getMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
38
+ import { calcMediaSinglePixelWidth, MEDIA_SINGLE_GUTTER_SIZE, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
39
39
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
40
40
  var MediaSingleNode = /*#__PURE__*/function (_Component) {
41
41
  _inherits(MediaSingleNode, _Component);
@@ -354,16 +354,25 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
354
354
  height = DEFAULT_IMAGE_HEIGHT;
355
355
  }
356
356
  var isSelected = selected();
357
+ var contentWidth = this.getLineLength(view, getPos()) || lineLength;
357
358
  var mediaSingleProps = {
358
359
  layout: layout,
359
360
  width: width,
360
361
  height: height,
361
362
  containerWidth: containerWidth,
362
- lineLength: this.getLineLength(view, getPos()) || lineLength,
363
+ lineLength: contentWidth,
363
364
  pctWidth: mediaSingleWidthAttribute,
364
365
  fullWidthMode: fullWidthMode,
365
366
  hasFallbackContainer: false,
366
- mediaSingleWidth: mediaSingleWidthAttribute && getMediaSinglePixelWidth(mediaSingleWidthAttribute, lineLength, widthType)
367
+ mediaSingleWidth: calcMediaSinglePixelWidth({
368
+ width: mediaSingleWidthAttribute,
369
+ widthType: widthType,
370
+ origWidth: width,
371
+ layout: layout,
372
+ contentWidth: contentWidth,
373
+ containerWidth: containerWidth,
374
+ gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
375
+ })
367
376
  };
368
377
  var ResizableMediaSingleProps = _objectSpread({
369
378
  view: view,
@@ -15,7 +15,7 @@ import React from 'react';
15
15
  import { jsx } from '@emotion/react';
16
16
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
17
17
  import { getMediaClient } from '@atlaskit/media-client';
18
- import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap, calcColumnsFromPx, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
18
+ import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap, calcColumnsFromPx } from '@atlaskit/editor-common/ui';
19
19
  import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
20
20
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
21
21
  import { wrapperStyle } from './styled';
@@ -26,9 +26,9 @@ import { messages } from './resizable-media-single-messages';
26
26
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
27
27
  import classnames from 'classnames';
28
28
  import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
29
- import { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP } from '@atlaskit/editor-common/media-single';
30
- import { findClosestSnap, getSnapWidth, getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
31
- import { generateDefaultGuidelines, generateDynamicGuidelines } from './guidelines';
29
+ import { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
30
+ import { findClosestSnap, getSnapWidth, getGuidelinesWithHighlights, generateDynamicGuidelines } from '@atlaskit/editor-common/guideline';
31
+ import { generateDefaultGuidelines } from './guidelines';
32
32
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
33
33
  export function calcOffsetLeft(insideInlineLike, insideLayout, pmViewDom, wrapper) {
34
34
  if (wrapper && insideInlineLike && !insideLayout) {
@@ -128,7 +128,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
128
128
  tr.setMeta('mediaSinglePlugin.isResizing', isResizing);
129
129
  return dispatch(tr);
130
130
  });
131
- var initialWidth = props.mediaSingleWidth || _this.calcInitialWidth();
131
+ var initialWidth = props.mediaSingleWidth || DEFAULT_IMAGE_WIDTH;
132
132
  _this.state = {
133
133
  offsetLeft: calcOffsetLeft(_this.insideInlineLike, _this.insideLayout, _this.props.view.dom, undefined),
134
134
  // We default to true until we resolve the file type
@@ -178,10 +178,10 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
178
178
  var guidelines = this.getDefaultGuidelines();
179
179
  this.displayGuideline(guidelines);
180
180
  }
181
- if (prevProps.lineLength === undefined && this.props.lineLength !== undefined && this.props.mediaSingleWidth === null) {
182
- // re-initalises size when lineLength becomes defined later
181
+ if (prevProps.mediaSingleWidth !== this.props.mediaSingleWidth && this.props.mediaSingleWidth) {
182
+ // update size when lineLength becomes defined later
183
183
  // ensures extended experience renders legacy image with the same size as the legacy experience
184
- var initialWidth = this.calcInitialWidth();
184
+ var initialWidth = this.props.mediaSingleWidth;
185
185
  this.setState({
186
186
  size: {
187
187
  width: initialWidth,
@@ -215,11 +215,13 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
215
215
  }, {
216
216
  key: "getSnaps",
217
217
  value: function getSnaps() {
218
- var view = this.props.view;
218
+ var _this$props5 = this.props,
219
+ view = _this$props5.view,
220
+ lineLength = _this$props5.lineLength;
219
221
  var dom = view.dom;
220
222
  var defaultGuidelines = this.getDefaultGuidelines();
221
223
  // disable guidelines for nested media single node
222
- var dynamicGuidelines = this.isNestedNode() ? [] : generateDynamicGuidelines(view);
224
+ var dynamicGuidelines = this.isNestedNode() ? [] : generateDynamicGuidelines(view.state, lineLength);
223
225
  var guidelines = [].concat(_toConsumableArray(defaultGuidelines), _toConsumableArray(dynamicGuidelines));
224
226
  var mediaSingleSelector = 'div.mediaSingleView-content-wrap.ProseMirror-selectednode';
225
227
  var _dom$getBoundingClien = dom.getBoundingClientRect(),
@@ -406,15 +408,15 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
406
408
  key: "render",
407
409
  value: function render() {
408
410
  var _this2 = this;
409
- var _this$props5 = this.props,
410
- origWidth = _this$props5.width,
411
- layout = _this$props5.layout,
412
- pctWidth = _this$props5.pctWidth,
413
- containerWidth = _this$props5.containerWidth,
414
- fullWidthMode = _this$props5.fullWidthMode,
415
- selected = _this$props5.selected,
416
- children = _this$props5.children,
417
- intl = _this$props5.intl;
411
+ var _this$props6 = this.props,
412
+ origWidth = _this$props6.width,
413
+ layout = _this$props6.layout,
414
+ pctWidth = _this$props6.pctWidth,
415
+ containerWidth = _this$props6.containerWidth,
416
+ fullWidthMode = _this$props6.fullWidthMode,
417
+ selected = _this$props6.selected,
418
+ children = _this$props6.children,
419
+ intl = _this$props6.intl;
418
420
  var _this$state = this.state,
419
421
  isResizing = _this$state.isResizing,
420
422
  size = _this$state.size;