@atlaskit/editor-core 187.10.8 → 187.12.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 (118) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -4
  3. package/dist/cjs/editor-next/editor-internal.js +0 -2
  4. package/dist/cjs/editor-next/hooks/useProviderFactory.js +2 -2
  5. package/dist/cjs/editor-next/index.js +0 -2
  6. package/dist/cjs/editor.js +6 -2
  7. package/dist/cjs/index.js +2 -94
  8. package/dist/cjs/plugins/help-dialog/ui/index.js +42 -42
  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 +11 -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/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +3 -3
  21. package/dist/cjs/version-wrapper.js +1 -1
  22. package/dist/cjs/version.json +1 -1
  23. package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -4
  24. package/dist/es2019/editor-next/editor-internal.js +0 -2
  25. package/dist/es2019/editor-next/hooks/useProviderFactory.js +2 -2
  26. package/dist/es2019/editor-next/index.js +0 -2
  27. package/dist/es2019/editor.js +5 -0
  28. package/dist/es2019/index.js +0 -2
  29. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -1
  30. package/dist/es2019/plugins/paste/handlers.js +5 -7
  31. package/dist/es2019/plugins/text-formatting/actions.js +161 -0
  32. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -159
  33. package/dist/es2019/plugins/text-formatting/index.js +115 -102
  34. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  35. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
  36. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  37. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  38. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  39. package/dist/es2019/plugins/text-formatting/utils.js +1 -29
  40. package/dist/es2019/ui/ContentStyles/index.js +2 -3
  41. package/dist/es2019/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
  42. package/dist/es2019/version-wrapper.js +1 -1
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -4
  45. package/dist/esm/editor-next/editor-internal.js +0 -2
  46. package/dist/esm/editor-next/hooks/useProviderFactory.js +2 -2
  47. package/dist/esm/editor-next/index.js +0 -2
  48. package/dist/esm/editor.js +6 -2
  49. package/dist/esm/index.js +0 -2
  50. package/dist/esm/plugins/help-dialog/ui/index.js +1 -1
  51. package/dist/esm/plugins/paste/handlers.js +5 -7
  52. package/dist/esm/plugins/text-formatting/actions.js +168 -0
  53. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -166
  54. package/dist/esm/plugins/text-formatting/index.js +11 -0
  55. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +8 -8
  56. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
  57. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +1 -1
  58. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +9 -9
  59. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
  60. package/dist/esm/plugins/text-formatting/utils.js +6 -33
  61. package/dist/esm/ui/ContentStyles/index.js +2 -3
  62. package/dist/esm/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
  63. package/dist/esm/version-wrapper.js +1 -1
  64. package/dist/esm/version.json +1 -1
  65. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -1
  66. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +4 -4
  67. package/dist/types/editor.d.ts +1 -0
  68. package/dist/types/index.d.ts +6 -4
  69. package/dist/types/labs/next/presets/default.d.ts +50 -15
  70. package/dist/types/labs/next/presets/useUniversalPreset.d.ts +2 -2
  71. package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  72. package/dist/types/plugins/paste/handlers.d.ts +1 -2
  73. package/dist/types/plugins/text-formatting/actions.d.ts +22 -0
  74. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  75. package/dist/types/plugins/text-formatting/index.d.ts +11 -2
  76. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  77. package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  78. package/dist/types/plugins/text-formatting/utils.d.ts +1 -5
  79. package/dist/types/types/editor-props.d.ts +11 -12
  80. package/dist/types/ui/ContentStyles/index.d.ts +1 -1
  81. package/dist/types/utils/editorDeprecationWarnings.d.ts +2 -0
  82. package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -1
  83. package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +4 -4
  84. package/dist/types-ts4.5/editor.d.ts +1 -0
  85. package/dist/types-ts4.5/index.d.ts +6 -4
  86. package/dist/types-ts4.5/labs/next/presets/default.d.ts +50 -15
  87. package/dist/types-ts4.5/labs/next/presets/useUniversalPreset.d.ts +2 -2
  88. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +1 -1
  89. package/dist/types-ts4.5/plugins/paste/handlers.d.ts +1 -2
  90. package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +22 -0
  91. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -31
  92. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +11 -2
  93. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +1 -2
  94. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +1 -1
  95. package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +1 -5
  96. package/dist/types-ts4.5/types/editor-props.d.ts +11 -12
  97. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -1
  98. package/dist/types-ts4.5/utils/editorDeprecationWarnings.d.ts +2 -0
  99. package/package.json +3 -3
  100. package/report.api.md +39 -166
  101. package/tmp/api-report-tmp.d.ts +36 -135
  102. package/dist/cjs/plugins/text-formatting/styles.js +0 -15
  103. package/dist/cjs/plugins/text-formatting/types.js +0 -5
  104. package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -95
  105. package/dist/es2019/plugins/text-formatting/styles.js +0 -5
  106. package/dist/es2019/plugins/text-formatting/types.js +0 -1
  107. package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  108. package/dist/esm/plugins/text-formatting/styles.js +0 -7
  109. package/dist/esm/plugins/text-formatting/types.js +0 -1
  110. package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +0 -88
  111. package/dist/types/editor-next/utils/deprecationWarnings.d.ts +0 -2
  112. package/dist/types/plugins/text-formatting/styles.d.ts +0 -2
  113. package/dist/types/plugins/text-formatting/types.d.ts +0 -30
  114. package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
  115. package/dist/types-ts4.5/editor-next/utils/deprecationWarnings.d.ts +0 -2
  116. package/dist/types-ts4.5/plugins/text-formatting/styles.d.ts +0 -2
  117. package/dist/types-ts4.5/plugins/text-formatting/types.d.ts +0 -30
  118. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +0 -87
@@ -9,106 +9,119 @@ 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
- const textFormatting = (options = {}, api) => ({
13
- name: 'textFormatting',
14
- marks() {
15
- return [{
16
- name: 'em',
17
- mark: em
18
- }, {
19
- name: 'strong',
20
- mark: strong
21
- }, {
22
- name: 'strike',
23
- mark: strike
24
- }].concat(options.disableCode ? [] : {
25
- name: 'code',
26
- mark: code
27
- }).concat(options.disableSuperscriptAndSubscript ? [] : {
28
- name: 'subsup',
29
- mark: subsup
30
- }).concat(options.disableUnderline ? [] : {
31
- name: 'underline',
32
- mark: underline
33
- });
34
- },
35
- pmPlugins() {
36
- return [{
37
- name: 'textFormatting',
38
- plugin: ({
39
- dispatch
40
- }) => {
41
- var _api$dependencies$ana;
42
- return textFormattingPlugin(dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
43
- }
44
- }, {
45
- name: 'textFormattingCursor',
46
- plugin: () => textFormattingCursorPlugin
47
- }, {
48
- name: 'textFormattingInputRule',
49
- // Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
50
- plugin: ({
51
- schema,
52
- featureFlags
53
- }) => {
54
- var _api$dependencies$ana2;
55
- return textFormattingInputRulePlugin(schema, featureFlags, 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);
56
- }
57
- }, {
58
- name: 'textFormattingSmartRule',
59
- plugin: () => {
60
- var _api$dependencies$ana3;
61
- return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(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) : undefined;
62
- }
63
- }, {
64
- name: 'textFormattingClear',
65
- plugin: ({
66
- dispatch
67
- }) => clearFormattingPlugin(dispatch)
68
- }, {
69
- name: 'textFormattingClearKeymap',
70
- plugin: () => {
71
- var _api$dependencies$ana4;
72
- return clearFormattingKeymapPlugin(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);
73
- }
74
- }, {
75
- name: 'textFormattingKeymap',
76
- plugin: ({
77
- schema
78
- }) => {
79
- var _api$dependencies$ana5;
80
- return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
81
- }
82
- }];
83
- },
84
- primaryToolbarComponent({
85
- editorView,
86
- popupsMountPoint,
87
- popupsScrollableElement,
88
- isToolbarReducedSpacing,
89
- toolbarSize,
90
- disabled
91
- }) {
92
- return /*#__PURE__*/React.createElement(WithPluginState, {
93
- plugins: {
94
- textFormattingState: textFormattingPluginKey,
95
- clearFormattingPluginState: clearFormattingPluginKey
96
- },
97
- render: () => {
98
- var _api$dependencies$ana6;
99
- return /*#__PURE__*/React.createElement(Toolbar, {
100
- editorState: editorView.state,
101
- popupsMountPoint: popupsMountPoint,
102
- popupsScrollableElement: popupsScrollableElement,
103
- toolbarSize: toolbarSize,
104
- isReducedSpacing: isToolbarReducedSpacing,
105
- editorView: editorView,
106
- isToolbarDisabled: disabled,
107
- shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
108
- editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
109
- });
110
- }
111
- });
112
- }
113
- });
12
+ import { toggleSuperscriptWithAnalytics, toggleSubscriptWithAnalytics, toggleStrikeWithAnalytics, toggleCodeWithAnalytics, toggleUnderlineWithAnalytics, toggleEmWithAnalytics, toggleStrongWithAnalytics } from './actions';
13
+ const textFormatting = (options = {}, api) => {
14
+ var _api$dependencies$ana7, _api$dependencies$ana8, _api$dependencies$ana9, _api$dependencies$ana10, _api$dependencies$ana11, _api$dependencies$ana12, _api$dependencies$ana13;
15
+ return {
16
+ name: 'textFormatting',
17
+ marks() {
18
+ return [{
19
+ name: 'em',
20
+ mark: em
21
+ }, {
22
+ name: 'strong',
23
+ mark: strong
24
+ }, {
25
+ name: 'strike',
26
+ mark: strike
27
+ }].concat(options.disableCode ? [] : {
28
+ name: 'code',
29
+ mark: code
30
+ }).concat(options.disableSuperscriptAndSubscript ? [] : {
31
+ name: 'subsup',
32
+ mark: subsup
33
+ }).concat(options.disableUnderline ? [] : {
34
+ name: 'underline',
35
+ mark: underline
36
+ });
37
+ },
38
+ pmPlugins() {
39
+ return [{
40
+ name: 'textFormatting',
41
+ plugin: ({
42
+ dispatch
43
+ }) => {
44
+ var _api$dependencies$ana;
45
+ 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);
46
+ }
47
+ }, {
48
+ name: 'textFormattingCursor',
49
+ plugin: () => textFormattingCursorPlugin
50
+ }, {
51
+ name: 'textFormattingInputRule',
52
+ // Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
53
+ plugin: ({
54
+ schema,
55
+ featureFlags
56
+ }) => {
57
+ var _api$dependencies$ana2;
58
+ return textFormattingInputRulePlugin(schema, featureFlags, 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);
59
+ }
60
+ }, {
61
+ name: 'textFormattingSmartRule',
62
+ plugin: () => {
63
+ var _api$dependencies$ana3;
64
+ return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(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) : undefined;
65
+ }
66
+ }, {
67
+ name: 'textFormattingClear',
68
+ plugin: ({
69
+ dispatch
70
+ }) => clearFormattingPlugin(dispatch)
71
+ }, {
72
+ name: 'textFormattingClearKeymap',
73
+ plugin: () => {
74
+ var _api$dependencies$ana4;
75
+ return clearFormattingKeymapPlugin(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);
76
+ }
77
+ }, {
78
+ name: 'textFormattingKeymap',
79
+ plugin: ({
80
+ schema
81
+ }) => {
82
+ var _api$dependencies$ana5;
83
+ return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
84
+ }
85
+ }];
86
+ },
87
+ primaryToolbarComponent({
88
+ editorView,
89
+ popupsMountPoint,
90
+ popupsScrollableElement,
91
+ isToolbarReducedSpacing,
92
+ toolbarSize,
93
+ disabled
94
+ }) {
95
+ return /*#__PURE__*/React.createElement(WithPluginState, {
96
+ plugins: {
97
+ textFormattingState: textFormattingPluginKey,
98
+ clearFormattingPluginState: clearFormattingPluginKey
99
+ },
100
+ render: () => {
101
+ var _api$dependencies$ana6;
102
+ return /*#__PURE__*/React.createElement(Toolbar, {
103
+ editorState: editorView.state,
104
+ popupsMountPoint: popupsMountPoint,
105
+ popupsScrollableElement: popupsScrollableElement,
106
+ toolbarSize: toolbarSize,
107
+ isReducedSpacing: isToolbarReducedSpacing,
108
+ editorView: editorView,
109
+ isToolbarDisabled: disabled,
110
+ shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
111
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
112
+ });
113
+ }
114
+ });
115
+ },
116
+ actions: {
117
+ toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions),
118
+ toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions),
119
+ toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions),
120
+ toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions),
121
+ toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana11 = api.dependencies.analytics) === null || _api$dependencies$ana11 === void 0 ? void 0 : _api$dependencies$ana11.actions),
122
+ toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana12 = api.dependencies.analytics) === null || _api$dependencies$ana12 === void 0 ? void 0 : _api$dependencies$ana12.actions),
123
+ toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana13 = api.dependencies.analytics) === null || _api$dependencies$ana13 === void 0 ? void 0 : _api$dependencies$ana13.actions)
124
+ }
125
+ };
126
+ };
114
127
  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
- import { nextMajorVersion } from '../../version-wrapper';
2
- export default function deprecationWarnings(props) {
1
+ import { nextMajorVersion } from '../version-wrapper';
2
+ export default function editorDeprecationWarnings(props) {
3
3
  if (process.env.NODE_ENV === 'production') {
4
4
  return;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.10.8";
2
+ export const version = "187.12.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.8",
3
+ "version": "187.12.0",
4
4
  "sideEffects": false
5
5
  }
@@ -151,9 +151,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
151
151
  }
152
152
  });
153
153
  _defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (payload) {
154
- if (!_this.props.allowAnalyticsGASV3) {
155
- return;
156
- }
157
154
  fireAnalyticsEvent(_this.props.createAnalyticsEvent)(payload);
158
155
  });
159
156
  _defineProperty(_assertThisInitialized(_this), "editorPlugins", []);
@@ -500,7 +497,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
500
497
  }
501
498
  });
502
499
  _defineProperty(_assertThisInitialized(_this), "dispatchAnalyticsEvent", function (payload) {
503
- if (_this.props.allowAnalyticsGASV3 && _this.eventDispatcher) {
500
+ if (_this.eventDispatcher) {
504
501
  var dispatch = createDispatch(_this.eventDispatcher);
505
502
  dispatch(analyticsEventKey, {
506
503
  payload: payload
@@ -92,7 +92,6 @@ export function EditorInternalWithoutHooks(_ref) {
92
92
  providerFactory: providerFactory,
93
93
  onEditorCreated: onEditorCreated,
94
94
  onEditorDestroyed: onEditorDestroyed,
95
- allowAnalyticsGASV3: props.allowAnalyticsGASV3,
96
95
  disabled: props.disabled,
97
96
  preset: preset,
98
97
  render: function render(_ref2) {
@@ -126,7 +125,6 @@ export function EditorInternalWithoutHooks(_ref) {
126
125
  primaryToolbarComponents: config.primaryToolbarComponents,
127
126
  primaryToolbarIconBefore: props.primaryToolbarIconBefore,
128
127
  secondaryToolbarComponents: config.secondaryToolbarComponents,
129
- insertMenuItems: props.insertMenuItems,
130
128
  customContentComponents: props.contentComponents,
131
129
  customPrimaryToolbarComponents: props.primaryToolbarComponents,
132
130
  customSecondaryToolbarComponents: props.secondaryToolbarComponents,
@@ -30,8 +30,6 @@ export default function useProviderFactory(props, editorActions, createAnalytics
30
30
  var extensionProviders = props.extensionProviders,
31
31
  quickInsert = props.quickInsert,
32
32
  linking = props.linking,
33
- smartLinks = props.smartLinks,
34
- UNSAFE_cards = props.UNSAFE_cards,
35
33
  autoformattingProvider = props.autoformattingProvider,
36
34
  media = props.media,
37
35
  emojiProvider = props.emojiProvider,
@@ -45,6 +43,8 @@ export default function useProviderFactory(props, editorActions, createAnalytics
45
43
  collabEdit = props.collabEdit,
46
44
  collabEditProvider = props.collabEditProvider,
47
45
  presenceProvider = props.presenceProvider;
46
+ var UNSAFE_cards = props.UNSAFE_cards;
47
+ var smartLinks = props.smartLinks;
48
48
  var providerFactory = useRef(new ProviderFactory());
49
49
  var _useState = useState(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)),
50
50
  _useState2 = _slicedToArray(_useState, 2),
@@ -18,7 +18,6 @@ import { useConstructor } from '@atlaskit/editor-common/hooks';
18
18
  import { useEditorContext } from '../ui/EditorContext';
19
19
  import measurements from '../utils/performance/measure-enum';
20
20
  import EditorInternal from './editor-internal';
21
- import deprecationWarnings from './utils/deprecationWarnings';
22
21
  import sendDurationAnalytics from './utils/sendDurationAnalytics';
23
22
  import trackEditorActions from './utils/trackEditorActions';
24
23
  export function Editor(passedProps) {
@@ -39,7 +38,6 @@ export function Editor(passedProps) {
39
38
  return fireAnalyticsEvent(createAnalyticsEvent)(data);
40
39
  };
41
40
  useConstructor(function () {
42
- deprecationWarnings(props);
43
41
  trackEditorActions(editorActions.current, props.performanceTracking, function (value) {
44
42
  return handleAnalyticsEvent(value);
45
43
  });
@@ -10,6 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
  /** @jsx jsx */
11
11
  import React from 'react';
12
12
  import { jsx } from '@emotion/react';
13
+ import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
13
14
  import EditorNext from './editor-next';
14
15
  import useUniversalPreset from './labs/next/presets/useUniversalPreset';
15
16
  var EditorNextWrapper = function EditorNextWrapper(_ref) {
@@ -24,9 +25,12 @@ var EditorNextWrapper = function EditorNextWrapper(_ref) {
24
25
  var Editor = /*#__PURE__*/function (_React$Component) {
25
26
  _inherits(Editor, _React$Component);
26
27
  var _super = _createSuper(Editor);
27
- function Editor() {
28
+ function Editor(props) {
29
+ var _this;
28
30
  _classCallCheck(this, Editor);
29
- return _super.apply(this, arguments);
31
+ _this = _super.call(this, props);
32
+ editorDeprecationWarnings(props);
33
+ return _this;
30
34
  }
31
35
  _createClass(Editor, [{
32
36
  key: "render",
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';
@@ -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;