@atlaskit/editor-core 179.0.3 → 179.1.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 (107) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +1 -1
  3. package/dist/cjs/create-editor/create-plugins-list.js +6 -287
  4. package/dist/cjs/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
  5. package/dist/cjs/editor.js +41 -8
  6. package/dist/cjs/labs/next/presets/universal.js +313 -0
  7. package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +24 -5
  8. package/dist/cjs/plugins/floating-toolbar/index.js +6 -0
  9. package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +72 -0
  10. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +12 -9
  11. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
  12. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
  13. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +40 -1
  14. package/dist/cjs/plugins/list/commands/outdent-list.js +22 -9
  15. package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
  16. package/dist/cjs/plugins/list/utils/analytics.js +18 -2
  17. package/dist/cjs/plugins/media/commands/linking.js +2 -2
  18. package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +1 -12
  19. package/dist/cjs/plugins/media/toolbar/alt-text.js +14 -3
  20. package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
  21. package/dist/cjs/plugins/media/toolbar/linking.js +7 -1
  22. package/dist/cjs/plugins/paste/handlers.js +7 -5
  23. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
  24. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +13 -13
  25. package/dist/cjs/test-utils.js +13 -1
  26. package/dist/cjs/utils/document.js +3 -2
  27. package/dist/cjs/utils/input-rules.js +3 -2
  28. package/dist/cjs/utils/lists.js +31 -0
  29. package/dist/cjs/utils/prepare-quick-insert-provider.js +22 -0
  30. package/dist/cjs/version-wrapper.js +1 -1
  31. package/dist/cjs/version.json +1 -1
  32. package/dist/es2019/create-editor/ReactEditorView.js +1 -1
  33. package/dist/es2019/create-editor/create-plugins-list.js +5 -293
  34. package/dist/es2019/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
  35. package/dist/es2019/editor.js +41 -7
  36. package/dist/es2019/labs/next/presets/universal.js +311 -0
  37. package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +19 -2
  38. package/dist/es2019/plugins/floating-toolbar/index.js +4 -0
  39. package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +59 -0
  40. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -3
  41. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
  42. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
  43. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +41 -1
  44. package/dist/es2019/plugins/list/commands/outdent-list.js +16 -1
  45. package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +29 -11
  46. package/dist/es2019/plugins/list/utils/analytics.js +12 -0
  47. package/dist/es2019/plugins/media/commands/linking.js +2 -2
  48. package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -12
  49. package/dist/es2019/plugins/media/toolbar/alt-text.js +14 -3
  50. package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
  51. package/dist/es2019/plugins/media/toolbar/linking.js +9 -1
  52. package/dist/es2019/plugins/paste/handlers.js +8 -6
  53. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
  54. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +13 -13
  55. package/dist/es2019/test-utils.js +11 -1
  56. package/dist/es2019/utils/document.js +3 -2
  57. package/dist/es2019/utils/input-rules.js +3 -2
  58. package/dist/es2019/utils/lists.js +26 -0
  59. package/dist/es2019/utils/prepare-quick-insert-provider.js +17 -0
  60. package/dist/es2019/version-wrapper.js +1 -1
  61. package/dist/es2019/version.json +1 -1
  62. package/dist/esm/create-editor/ReactEditorView.js +1 -1
  63. package/dist/esm/create-editor/create-plugins-list.js +6 -287
  64. package/dist/esm/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
  65. package/dist/esm/editor.js +41 -8
  66. package/dist/esm/labs/next/presets/universal.js +306 -0
  67. package/dist/esm/plugins/card/ui/EditLinkToolbar.js +24 -5
  68. package/dist/esm/plugins/floating-toolbar/index.js +6 -0
  69. package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +62 -0
  70. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +12 -9
  71. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
  72. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
  73. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +40 -1
  74. package/dist/esm/plugins/list/commands/outdent-list.js +15 -2
  75. package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
  76. package/dist/esm/plugins/list/utils/analytics.js +12 -0
  77. package/dist/esm/plugins/media/commands/linking.js +2 -2
  78. package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -12
  79. package/dist/esm/plugins/media/toolbar/alt-text.js +14 -3
  80. package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
  81. package/dist/esm/plugins/media/toolbar/linking.js +7 -1
  82. package/dist/esm/plugins/paste/handlers.js +8 -6
  83. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
  84. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +13 -13
  85. package/dist/esm/test-utils.js +11 -1
  86. package/dist/esm/utils/document.js +3 -2
  87. package/dist/esm/utils/input-rules.js +3 -2
  88. package/dist/esm/utils/lists.js +24 -0
  89. package/dist/esm/utils/prepare-quick-insert-provider.js +17 -0
  90. package/dist/esm/version-wrapper.js +1 -1
  91. package/dist/esm/version.json +1 -1
  92. package/dist/types/create-editor/create-plugins-list.d.ts +5 -4
  93. package/dist/types/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.d.ts +2 -2
  94. package/dist/types/editor.d.ts +42 -0
  95. package/dist/types/labs/next/presets/universal.d.ts +30 -0
  96. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -0
  97. package/dist/types/plugins/expand/index.d.ts +4 -1
  98. package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +18 -0
  99. package/dist/types/plugins/list/utils/analytics.d.ts +5 -2
  100. package/dist/types/plugins/media/commands/linking.d.ts +1 -1
  101. package/dist/types/test-utils.d.ts +7 -0
  102. package/dist/types/types/editor-props.d.ts +96 -92
  103. package/dist/types/utils/input-rules.d.ts +2 -1
  104. package/dist/types/utils/lists.d.ts +2 -0
  105. package/dist/types/utils/prepare-quick-insert-provider.d.ts +16 -0
  106. package/package.json +8 -8
  107. package/report.api.md +89 -79
@@ -1,11 +1,7 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, cardPlugin, gridPlugin, statusPlugin, alignmentPlugin, indentationPlugin, analyticsPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin } from '../plugins';
2
- import { tablesPlugin } from '@atlaskit/editor-plugin-table';
3
- import { isFullPage as fullPageCheck } from '../utils/is-full-page';
1
+ import createUniversalPreset from '../labs/next/presets/universal';
4
2
  import { GUTTER_SIZE_MOBILE_IN_PX } from '../plugins/base/pm-plugins/scroll-gutter';
5
- import { createFeatureFlagsFromProps } from '../plugins/feature-flags-context/feature-flags-from-props';
6
- import { getMediaFeatureFlag } from '@atlaskit/media-common';
7
- import { createDefaultPreset } from '../labs/next/presets/default';
8
- import { shouldForceTracking } from '@atlaskit/editor-common/utils';
3
+ import { isFullPage as fullPageCheck } from '../utils/is-full-page';
4
+ import { createFeatureFlagsFromProps } from './feature-flags-from-props';
9
5
  const isCodeBlockAllowed = options => {
10
6
  const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
11
7
  return exclude.indexOf('codeBlock') === -1;
@@ -39,6 +35,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
39
35
  const inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
40
36
  const cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
41
37
  return {
38
+ ...props,
42
39
  createAnalyticsEvent,
43
40
  typeAhead: {
44
41
  createAnalyticsEvent,
@@ -103,292 +100,7 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
103
100
  * their placement in the editor toolbar
104
101
  */
105
102
  export default function createPluginsList(props, prevProps, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth) {
106
- var _props$linking3;
107
- const appearance = props.appearance;
108
- const isMobile = appearance === 'mobile';
109
- const isComment = appearance === 'comment';
110
- const isFullPage = fullPageCheck(appearance);
111
- const preset = createDefaultPreset(getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent));
112
- const featureFlags = createFeatureFlagsFromProps(props);
113
- const getEditorFeatureFlags = () => featureFlags;
114
- if (props.allowAnalyticsGASV3) {
115
- const {
116
- performanceTracking
117
- } = props;
118
- preset.add([analyticsPlugin, {
119
- createAnalyticsEvent,
120
- performanceTracking
121
- }]);
122
- }
123
- if (props.allowBreakout && isFullPage) {
124
- preset.add([breakoutPlugin, {
125
- allowBreakoutButton: props.appearance === 'full-page'
126
- }]);
127
- }
128
- if (props.allowTextAlignment) {
129
- preset.add(alignmentPlugin);
130
- }
131
- preset.add(dataConsumerMarkPlugin);
132
- if (props.allowTextColor) {
133
- preset.add([textColorPlugin, props.allowTextColor]);
134
- }
135
-
136
- // Needs to be after allowTextColor as order of buttons in toolbar depends on it
137
- preset.add([listPlugin, {
138
- restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists,
139
- restartNumberedListsToolbar: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedListsToolbar,
140
- listNumberContinuity: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.listNumberContinuity
141
- }]);
142
- if (props.allowRule) {
143
- preset.add(rulePlugin);
144
- }
145
- if (props.allowExpand) {
146
- preset.add([expandPlugin, {
147
- allowInsertion: isExpandInsertionEnabled(props),
148
- useLongPressSelection: false,
149
- appearance: props.appearance
150
- }]);
151
- }
152
- if (props.media) {
153
- preset.add([gridPlugin, {
154
- shouldCalcBreakoutGridLines: isFullPage
155
- }]);
156
- const alignLeftOnInsert = typeof props.media.alignLeftOnInsert !== 'undefined' ? props.media.alignLeftOnInsert : isComment;
157
- const showMediaLayoutOptions = typeof props.media.allowAdvancedToolBarOptions !== 'undefined' ? props.media.allowAdvancedToolBarOptions : isFullPage || isComment;
158
- preset.add([mediaPlugin, {
159
- ...props.media,
160
- allowLazyLoading: !isMobile,
161
- allowBreakoutSnapPoints: isFullPage,
162
- allowAdvancedToolBarOptions: showMediaLayoutOptions,
163
- allowDropzoneDropLine: isFullPage,
164
- allowMediaSingleEditable: !isMobile,
165
- allowRemoteDimensionsFetch: !isMobile,
166
- editorSelectionAPI,
167
- // This is a wild one. I didnt quite understand what the code was doing
168
- // so a bit of guess for now.
169
- allowMarkingUploadsAsIncomplete: isMobile,
170
- fullWidthEnabled: props.appearance === 'full-width',
171
- uploadErrorHandler: props.uploadErrorHandler,
172
- waitForMediaUpload: props.waitForMediaUpload,
173
- isCopyPasteEnabled: !isMobile,
174
- alignLeftOnInsert
175
- }]);
176
-
177
- // EDM-799: inside caption plugin we do the feature flag in enabling the plugin
178
- if (getMediaFeatureFlag('captions', props.media.featureFlags)) {
179
- preset.add(captionPlugin);
180
- }
181
- }
182
- if (props.mentionProvider) {
183
- var _props$mention$insert, _props$mention, _props$mention2;
184
- preset.add([mentionsPlugin, {
185
- createAnalyticsEvent,
186
- sanitizePrivateContent: props.sanitizePrivateContent,
187
- insertDisplayName: (_props$mention$insert = (_props$mention = props.mention) === null || _props$mention === void 0 ? void 0 : _props$mention.insertDisplayName) !== null && _props$mention$insert !== void 0 ? _props$mention$insert : props.mentionInsertDisplayName,
188
- allowZeroWidthSpaceAfter: !isMobile,
189
- HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent
190
- }]);
191
- }
192
- if (props.emojiProvider) {
193
- preset.add([emojiPlugin, {
194
- createAnalyticsEvent
195
- }]);
196
- }
197
- if (props.allowTables) {
198
- const tableOptions = !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables;
199
- preset.add([tablesPlugin, {
200
- tableOptions,
201
- breakoutEnabled: props.appearance === 'full-page',
202
- allowContextualMenu: !isMobile,
203
- fullWidthEnabled: props.appearance === 'full-width',
204
- wasFullWidthEnabled: prevProps && prevProps.appearance === 'full-width',
205
- editorAnalyticsAPI,
206
- editorSelectionAPI,
207
- getEditorFeatureFlags
208
- }]);
209
- }
210
- if (props.allowTasksAndDecisions || props.taskDecisionProvider) {
211
- preset.add([tasksAndDecisionsPlugin, {
212
- allowNestedTasks: props.allowNestedTasks,
213
- consumeTabs: isFullPage,
214
- useLongPressSelection: false
215
- }]);
216
- }
217
- if (props.feedbackInfo) {
218
- preset.add([feedbackDialogPlugin, props.feedbackInfo]);
219
- }
220
- if (props.allowHelpDialog) {
221
- preset.add([helpDialogPlugin, !!props.legacyImageUploadProvider]);
222
- }
223
- if (props.saveOnEnter && props.onSave) {
224
- preset.add([saveOnEnterPlugin, props.onSave]);
225
- }
226
- if (props.legacyImageUploadProvider) {
227
- preset.add(imageUploadPlugin);
228
- if (!props.media) {
229
- preset.add([mediaPlugin, {
230
- allowMediaSingle: {
231
- disableLayout: true
232
- },
233
- allowMediaGroup: false,
234
- isCopyPasteEnabled: true,
235
- editorSelectionAPI
236
- }]);
237
- }
238
- }
239
- if (props.collabEdit || props.collabEditProvider) {
240
- var _collabEditOptions$EX;
241
- let collabEditOptions = {
242
- sanitizePrivateContent: props.sanitizePrivateContent,
243
- createAnalyticsEvent
244
- };
245
- if (props.collabEdit) {
246
- collabEditOptions = {
247
- ...props.collabEdit,
248
- ...collabEditOptions
249
- };
250
- }
251
- preset.add([collabEditPlugin, {
252
- ...collabEditOptions,
253
- EXPERIMENTAL_allowInternalErrorAnalytics: (_collabEditOptions$EX = collabEditOptions.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _collabEditOptions$EX !== void 0 ? _collabEditOptions$EX : shouldForceTracking()
254
- }]);
255
- }
256
- if (props.maxContentSize) {
257
- preset.add([maxContentSizePlugin, props.maxContentSize]);
258
- }
259
- if (props.allowJiraIssue) {
260
- preset.add(jiraIssuePlugin);
261
- }
262
- if (props.allowPanel) {
263
- preset.add([panelPlugin, {
264
- useLongPressSelection: false,
265
- allowCustomPanel: props.allowPanel.allowCustomPanel,
266
- allowCustomPanelEdit: props.allowPanel.allowCustomPanelEdit
267
- }]);
268
- }
269
- if (props.allowExtension) {
270
- const extensionConfig = typeof props.allowExtension === 'object' ? props.allowExtension : {};
271
- preset.add([extensionPlugin, {
272
- breakoutEnabled: props.appearance === 'full-page' && extensionConfig.allowBreakout !== false,
273
- allowAutoSave: extensionConfig.allowAutoSave,
274
- extensionHandlers: props.extensionHandlers,
275
- useLongPressSelection: false,
276
- appearance
277
- }]);
278
- }
279
- if (props.macroProvider) {
280
- preset.add(macroPlugin);
281
- }
282
-
283
- // See default list for when adding annotations with a provider
284
- if (!props.annotationProviders && props.allowConfluenceInlineComment) {
285
- preset.add([annotationPlugin, undefined]);
286
- }
287
- if (props.allowDate) {
288
- preset.add(datePlugin);
289
- }
290
- if (props.allowTemplatePlaceholders) {
291
- const options = props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {};
292
- preset.add([placeholderTextPlugin, options]);
293
- }
294
- if (props.allowLayouts) {
295
- preset.add([layoutPlugin, {
296
- ...(typeof props.allowLayouts === 'boolean' ? {} : props.allowLayouts),
297
- useLongPressSelection: false,
298
- UNSAFE_allowSingleColumnLayout: props.allowLayouts.UNSAFE_allowSingleColumnLayout
299
- }]);
300
- }
301
- if ((_props$linking3 = props.linking) !== null && _props$linking3 !== void 0 && _props$linking3.smartLinks || props.smartLinks || props.UNSAFE_cards) {
302
- var _props$linking4, _props$linking5;
303
- const fullWidthMode = props.appearance === 'full-width';
304
- preset.add([cardPlugin, {
305
- ...props.UNSAFE_cards,
306
- ...props.smartLinks,
307
- ...((_props$linking4 = props.linking) === null || _props$linking4 === void 0 ? void 0 : _props$linking4.smartLinks),
308
- platform: isMobile ? 'mobile' : 'web',
309
- fullWidthMode,
310
- createAnalyticsEvent,
311
- linkPicker: (_props$linking5 = props.linking) === null || _props$linking5 === void 0 ? void 0 : _props$linking5.linkPicker
312
- }]);
313
- }
314
- if (props.autoformattingProvider) {
315
- preset.add(customAutoformatPlugin);
316
- }
317
- let statusMenuDisabled = true;
318
- if (props.allowStatus) {
319
- statusMenuDisabled = typeof props.allowStatus === 'object' ? props.allowStatus.menuDisabled : false;
320
- preset.add([statusPlugin, {
321
- menuDisabled: statusMenuDisabled,
322
- allowZeroWidthSpaceAfter: !isMobile
323
- }]);
324
- }
325
- if (props.allowIndentation) {
326
- preset.add(indentationPlugin);
327
- }
328
- if (isFullPage) {
329
- preset.add(contextPanelPlugin);
330
- }
331
- if (props.autoScrollIntoView !== false) {
332
- preset.add(scrollIntoViewPlugin);
333
- }
334
- if (isMobile || props.allowUndoRedoButtons) {
335
- preset.add(historyPlugin);
336
- }
337
- if (isMobile) {
338
- preset.add(mobileDimensionsPlugin);
339
- preset.add(mobileSelectionPlugin);
340
- }
341
-
342
- // UI only plugins
343
- preset.add([toolbarListsIndentationPlugin, {
344
- showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
345
- allowHeadingAndParagraphIndentation: !!props.allowIndentation
346
- }]);
347
- preset.add([insertBlockPlugin, {
348
- allowTables: !!props.allowTables,
349
- allowExpand: isExpandInsertionEnabled(props),
350
- insertMenuItems: props.insertMenuItems,
351
- horizontalRuleEnabled: props.allowRule,
352
- nativeStatusSupported: !statusMenuDisabled,
353
- showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
354
- replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false,
355
- insertNodeAPI
356
- }]);
357
- const hasBeforePrimaryToolbar = components => {
358
- if (components && 'before' in components) {
359
- return !!components.before;
360
- }
361
- return false;
362
- };
363
- if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
364
- preset.add([beforePrimaryToolbarPlugin, {
365
- beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
366
- }]);
367
- }
368
- if (featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
369
- preset.add([avatarGroupPlugin, {
370
- collabEdit: props.collabEdit,
371
- takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
372
- }]);
373
- }
374
- if (props.allowFindReplace) {
375
- preset.add([findReplacePlugin, {
376
- takeFullWidth: !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
377
- twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
378
- }]);
379
- }
380
- if (props.allowFragmentMark) {
381
- preset.add(fragmentMarkPlugin);
382
- }
383
- if (featureFlags.enableViewUpdateSubscription) {
384
- preset.add(viewUpdateSubscriptionPlugin);
385
- }
386
- preset.add([codeBidiWarningPlugin, {
387
- appearance: props.appearance
388
- }]);
389
- if (featureFlags.floatingToolbarCopyButton) {
390
- preset.add(copyButtonPlugin);
391
- }
103
+ const preset = createUniversalPreset(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), createFeatureFlagsFromProps(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth);
392
104
  const excludes = new Set();
393
105
  if (!isCodeBlockAllowed({
394
106
  allowBlockType: props.allowBlockType
@@ -21,10 +21,10 @@ import { PortalProviderWithThemeProviders, PortalRenderer } from './ui/PortalPro
21
21
  import { nextMajorVersion } from './version-wrapper';
22
22
  import { ContextAdapter } from './nodeviews/context-adapter';
23
23
  import measurements from './utils/performance/measure-enum';
24
- import { combineQuickInsertProviders, extensionProviderToQuickInsertProvider } from './utils/extensions';
24
+ import prepareQuickInsertProvider from './utils/prepare-quick-insert-provider';
25
25
  import { fireAnalyticsEvent, EVENT_TYPE, ACTION_SUBJECT, ACTION } from './plugins/analytics';
26
26
  import ErrorBoundary from './create-editor/ErrorBoundary';
27
- import { createFeatureFlagsFromProps } from './plugins/feature-flags-context/feature-flags-from-props';
27
+ import { createFeatureFlagsFromProps } from './create-editor/feature-flags-from-props';
28
28
  import { RenderTracking } from './utils/performance/components/RenderTracking';
29
29
  const fullHeight = css`
30
30
  height: 100%;
@@ -43,9 +43,7 @@ export default class Editor extends React.Component {
43
43
  return combineExtensionProviders(extensionProviders);
44
44
  }));
45
45
  _defineProperty(this, "prepareQuickInsertProvider", (extensionProvider, quickInsert) => {
46
- const quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
47
- const extensionQuickInsertProvider = extensionProvider && extensionProviderToQuickInsertProvider(extensionProvider, this.editorActions, this.createAnalyticsEvent);
48
- return quickInsertProvider && extensionQuickInsertProvider ? combineQuickInsertProviders([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
46
+ return prepareQuickInsertProvider(this.editorActions, extensionProvider, quickInsert, this.createAnalyticsEvent);
49
47
  });
50
48
  _defineProperty(this, "handleSave", view => {
51
49
  if (!this.props.onSave) {
@@ -105,10 +103,10 @@ export default class Editor extends React.Component {
105
103
  }, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiIdleThreshold, (_props$performanceTra7 = props.performanceTracking) === null || _props$performanceTra7 === void 0 ? void 0 : (_props$performanceTra8 = _props$performanceTra7.ttiTracking) === null || _props$performanceTra8 === void 0 ? void 0 : _props$performanceTra8.ttiCancelTimeout);
106
104
  }
107
105
  const _extensionProvider = this.prepareExtensionProvider(props.extensionProviders);
108
- const _quickInsertProvider = this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
106
+ const quickInsertProvider = this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
109
107
  this.state = {
110
108
  extensionProvider: _extensionProvider,
111
- quickInsertProvider: _quickInsertProvider
109
+ quickInsertProvider
112
110
  };
113
111
  }
114
112
  componentDidMount() {
@@ -148,6 +146,13 @@ export default class Editor extends React.Component {
148
146
  });
149
147
  }
150
148
  }
149
+
150
+ /**
151
+ * @private
152
+ * @deprecated - Do not override this at all, this is an anti-pattern.
153
+ * Please reach out to the Editor team if you were previously using this
154
+ * and need to find a workaround.
155
+ */
151
156
  trackEditorActions(editorActions, props) {
152
157
  var _props$performanceTra9, _props$performanceTra10;
153
158
  if (props !== null && props !== void 0 && (_props$performanceTra9 = props.performanceTracking) !== null && _props$performanceTra9 !== void 0 && (_props$performanceTra10 = _props$performanceTra9.contentRetrievalTracking) !== null && _props$performanceTra10 !== void 0 && _props$performanceTra10.enabled) {
@@ -216,6 +221,20 @@ export default class Editor extends React.Component {
216
221
  }
217
222
  return editorActions;
218
223
  }
224
+
225
+ /**
226
+ * @private
227
+ * @deprecated - Do not override this at all, this is an antipattern.
228
+ * Please reach out to the Editor team if you were previously using this
229
+ * and need to find a workaround.
230
+ */
231
+
232
+ /**
233
+ * @private
234
+ * @deprecated - Do not override this at all, this is an antipattern.
235
+ * Please reach out to the Editor team if you were previously using this
236
+ * and need to find a workaround.
237
+ */
219
238
  onEditorCreated(instance) {
220
239
  var _this$props$featureFl2;
221
240
  this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
@@ -297,6 +316,13 @@ export default class Editor extends React.Component {
297
316
  console.warn(`"allowMoreTextColors" field of "allowTextColor" property is deprecated. It will be removedin editor-core@${nextVersion}. The color palette now shows more colors by default.`);
298
317
  }
299
318
  }
319
+
320
+ /**
321
+ * @private
322
+ * @deprecated - Do not override this at all, this is an antipattern.
323
+ * Please reach out to the Editor team if you were previously using this
324
+ * and need to find a workaround.
325
+ */
300
326
  onEditorDestroyed(_instance) {
301
327
  this.unregisterEditorFromActions();
302
328
  if (this.props.onDestroy) {
@@ -361,6 +387,14 @@ export default class Editor extends React.Component {
361
387
  getBaseFontSize() {
362
388
  return !['comment', 'chromeless', 'mobile'].includes(this.props.appearance) ? akEditorFullPageDefaultFontSize : undefined;
363
389
  }
390
+
391
+ /**
392
+ * @private
393
+ * @deprecated - Do not override this at all, this is an antipattern.
394
+ * Please reach out to the Editor team if you were previously using this
395
+ * and need to find a workaround.
396
+ */
397
+
364
398
  render() {
365
399
  var _this$props$performan3, _this$props$performan4;
366
400
  const Component = getUiComponent(this.props.appearance);