@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 179.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ef0beaafa36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ef0beaafa36) - [ux] ED-15862: Add analytics for restartNumberedLists custom list start numbers
8
+ - [`75e0af42bcd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/75e0af42bcd) - [ux] ED-16568 added selected state to emoji button in the main toolbar, when it is clicked and emoji popup is displayed
9
+
10
+ ### Patch Changes
11
+
12
+ - [`e78c04fa97c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e78c04fa97c) - [ux] ED-16489 Fixed - textFormatBridge.updateTextWithADFStatus returns "isEmptyAdf: false" when ADF has only whitespace
13
+ - [`eab04c03dbc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eab04c03dbc) - ED-15641 Update transfromIndentationMarks() to remove heading indention from tableHeaders.
14
+ - [`4c16f77b286`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c16f77b286) - [ux] ED-15498 Added forceFocus plugin. The plugin handles moving focus back to a specified floating toolbar button after pressing ESC to close a floating toolbar submenu.
15
+ - [`a2ebf475e82`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a2ebf475e82) - ED-16197 Updating DOCUMENT_PROCESSING_ERROR event action to map to new event "documentProcessingErrorV2" and moving its errorStack attribute to nonPrivacySafeAttributes.
16
+ - [`b3d1ccd9059`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3d1ccd9059) - ED-16475: [ux] Added functionality for indentation buttons that shift focus to their counterpart button when they become disabled as a result of keyboard access and commands
17
+ - [`e1f9f1cfac1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e1f9f1cfac1) - ED-16559 This commit creates a new preset which contains all plugins for the editor. The create-plugins-list now uses this to create the plugins list.
18
+ - [`7ac23f207d6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7ac23f207d6) - ED-16557 - Refactor prepareQuickInsertProvider in Editor to make it more testable.
19
+ - [`f3386f58d81`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f3386f58d81) - [ux] ED-15391 When the floating toolbar unmounts or updates, remove any temporary styling that was added to table via hovering over a floating toolbar button.
20
+ - [`23eca7ad593`](https://bitbucket.org/atlassian/atlassian-frontend/commits/23eca7ad593) - [ux] [ED-15904] Fix regression where pasting blocknodes into a list would split the list instead of safe inserting
21
+ - [`0532d79f513`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0532d79f513) - Avoids having CSS for typeahead getting overriden by products.
22
+ - [`c4563e66246`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c4563e66246) - [ux] Fix for ED-15722 Top section of new dropdown menu is blocked from scrolling in Jira - dropdown aligns to bottom right
23
+ - Updated dependencies
24
+
25
+ ## 179.0.4
26
+
27
+ ### Patch Changes
28
+
29
+ - [`5139cd8cbdf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5139cd8cbdf) - [ED-16854] Add @deprecate annotations to public class methods in editor.
30
+
3
31
  ## 179.0.3
4
32
 
5
33
  ### Patch Changes
@@ -30,7 +30,7 @@ var _RenderTracking = require("../utils/performance/components/RenderTracking");
30
30
  var _nodes = require("../utils/nodes");
31
31
  var _createPluginsList = _interopRequireDefault(require("./create-plugins-list"));
32
32
  var _analytics = require("../plugins/analytics");
33
- var _featureFlagsFromProps = require("../plugins/feature-flags-context/feature-flags-from-props");
33
+ var _featureFlagsFromProps = require("./feature-flags-from-props");
34
34
  var _getEnabledFeatureFlagKeys = require("../plugins/feature-flags-context/get-enabled-feature-flag-keys");
35
35
  var _createEditor = require("./create-editor");
36
36
  var _documentLogger = require("../utils/document-logger");
@@ -7,16 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = createPluginsList;
8
8
  exports.getDefaultPresetOptionsFromEditorProps = getDefaultPresetOptionsFromEditorProps;
9
9
  exports.getScrollGutterOptions = getScrollGutterOptions;
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- var _plugins = require("../plugins");
13
- var _editorPluginTable = require("@atlaskit/editor-plugin-table");
14
- var _isFullPage = require("../utils/is-full-page");
11
+ var _universal = _interopRequireDefault(require("../labs/next/presets/universal"));
15
12
  var _scrollGutter = require("../plugins/base/pm-plugins/scroll-gutter");
16
- var _featureFlagsFromProps = require("../plugins/feature-flags-context/feature-flags-from-props");
17
- var _mediaCommon = require("@atlaskit/media-common");
18
- var _default = require("../labs/next/presets/default");
19
- var _utils = require("@atlaskit/editor-common/utils");
13
+ var _isFullPage = require("../utils/is-full-page");
14
+ var _featureFlagsFromProps = require("./feature-flags-from-props");
20
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
17
  var isCodeBlockAllowed = function isCodeBlockAllowed(options) {
@@ -53,7 +48,7 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
53
48
  var isMobile = appearance === 'mobile';
54
49
  var inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
55
50
  var cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
56
- return {
51
+ return _objectSpread(_objectSpread({}, props), {}, {
57
52
  createAnalyticsEvent: createAnalyticsEvent,
58
53
  typeAhead: {
59
54
  createAnalyticsEvent: createAnalyticsEvent,
@@ -106,7 +101,7 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
106
101
  appearance: props.appearance,
107
102
  allowCompositionInputOverride: isMobile
108
103
  })
109
- };
104
+ });
110
105
  }
111
106
 
112
107
  /**
@@ -116,283 +111,7 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
116
111
  * their placement in the editor toolbar
117
112
  */
118
113
  function createPluginsList(props, prevProps, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth) {
119
- var _props$linking3;
120
- var appearance = props.appearance;
121
- var isMobile = appearance === 'mobile';
122
- var isComment = appearance === 'comment';
123
- var isFullPage = (0, _isFullPage.isFullPage)(appearance);
124
- var preset = (0, _default.createDefaultPreset)(getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent));
125
- var featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props);
126
- var getEditorFeatureFlags = function getEditorFeatureFlags() {
127
- return featureFlags;
128
- };
129
- if (props.allowAnalyticsGASV3) {
130
- var performanceTracking = props.performanceTracking;
131
- preset.add([_plugins.analyticsPlugin, {
132
- createAnalyticsEvent: createAnalyticsEvent,
133
- performanceTracking: performanceTracking
134
- }]);
135
- }
136
- if (props.allowBreakout && isFullPage) {
137
- preset.add([_plugins.breakoutPlugin, {
138
- allowBreakoutButton: props.appearance === 'full-page'
139
- }]);
140
- }
141
- if (props.allowTextAlignment) {
142
- preset.add(_plugins.alignmentPlugin);
143
- }
144
- preset.add(_plugins.dataConsumerMarkPlugin);
145
- if (props.allowTextColor) {
146
- preset.add([_plugins.textColorPlugin, props.allowTextColor]);
147
- }
148
-
149
- // Needs to be after allowTextColor as order of buttons in toolbar depends on it
150
- preset.add([_plugins.listPlugin, {
151
- restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists,
152
- restartNumberedListsToolbar: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedListsToolbar,
153
- listNumberContinuity: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.listNumberContinuity
154
- }]);
155
- if (props.allowRule) {
156
- preset.add(_plugins.rulePlugin);
157
- }
158
- if (props.allowExpand) {
159
- preset.add([_plugins.expandPlugin, {
160
- allowInsertion: (0, _plugins.isExpandInsertionEnabled)(props),
161
- useLongPressSelection: false,
162
- appearance: props.appearance
163
- }]);
164
- }
165
- if (props.media) {
166
- preset.add([_plugins.gridPlugin, {
167
- shouldCalcBreakoutGridLines: isFullPage
168
- }]);
169
- var alignLeftOnInsert = typeof props.media.alignLeftOnInsert !== 'undefined' ? props.media.alignLeftOnInsert : isComment;
170
- var showMediaLayoutOptions = typeof props.media.allowAdvancedToolBarOptions !== 'undefined' ? props.media.allowAdvancedToolBarOptions : isFullPage || isComment;
171
- preset.add([_plugins.mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, {
172
- allowLazyLoading: !isMobile,
173
- allowBreakoutSnapPoints: isFullPage,
174
- allowAdvancedToolBarOptions: showMediaLayoutOptions,
175
- allowDropzoneDropLine: isFullPage,
176
- allowMediaSingleEditable: !isMobile,
177
- allowRemoteDimensionsFetch: !isMobile,
178
- editorSelectionAPI: editorSelectionAPI,
179
- // This is a wild one. I didnt quite understand what the code was doing
180
- // so a bit of guess for now.
181
- allowMarkingUploadsAsIncomplete: isMobile,
182
- fullWidthEnabled: props.appearance === 'full-width',
183
- uploadErrorHandler: props.uploadErrorHandler,
184
- waitForMediaUpload: props.waitForMediaUpload,
185
- isCopyPasteEnabled: !isMobile,
186
- alignLeftOnInsert: alignLeftOnInsert
187
- })]);
188
-
189
- // EDM-799: inside caption plugin we do the feature flag in enabling the plugin
190
- if ((0, _mediaCommon.getMediaFeatureFlag)('captions', props.media.featureFlags)) {
191
- preset.add(_plugins.captionPlugin);
192
- }
193
- }
194
- if (props.mentionProvider) {
195
- var _props$mention$insert, _props$mention, _props$mention2;
196
- preset.add([_plugins.mentionsPlugin, {
197
- createAnalyticsEvent: createAnalyticsEvent,
198
- sanitizePrivateContent: props.sanitizePrivateContent,
199
- 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,
200
- allowZeroWidthSpaceAfter: !isMobile,
201
- HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent
202
- }]);
203
- }
204
- if (props.emojiProvider) {
205
- preset.add([_plugins.emojiPlugin, {
206
- createAnalyticsEvent: createAnalyticsEvent
207
- }]);
208
- }
209
- if (props.allowTables) {
210
- var tableOptions = !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables;
211
- preset.add([_editorPluginTable.tablesPlugin, {
212
- tableOptions: tableOptions,
213
- breakoutEnabled: props.appearance === 'full-page',
214
- allowContextualMenu: !isMobile,
215
- fullWidthEnabled: props.appearance === 'full-width',
216
- wasFullWidthEnabled: prevProps && prevProps.appearance === 'full-width',
217
- editorAnalyticsAPI: editorAnalyticsAPI,
218
- editorSelectionAPI: editorSelectionAPI,
219
- getEditorFeatureFlags: getEditorFeatureFlags
220
- }]);
221
- }
222
- if (props.allowTasksAndDecisions || props.taskDecisionProvider) {
223
- preset.add([_plugins.tasksAndDecisionsPlugin, {
224
- allowNestedTasks: props.allowNestedTasks,
225
- consumeTabs: isFullPage,
226
- useLongPressSelection: false
227
- }]);
228
- }
229
- if (props.feedbackInfo) {
230
- preset.add([_plugins.feedbackDialogPlugin, props.feedbackInfo]);
231
- }
232
- if (props.allowHelpDialog) {
233
- preset.add([_plugins.helpDialogPlugin, !!props.legacyImageUploadProvider]);
234
- }
235
- if (props.saveOnEnter && props.onSave) {
236
- preset.add([_plugins.saveOnEnterPlugin, props.onSave]);
237
- }
238
- if (props.legacyImageUploadProvider) {
239
- preset.add(_plugins.imageUploadPlugin);
240
- if (!props.media) {
241
- preset.add([_plugins.mediaPlugin, {
242
- allowMediaSingle: {
243
- disableLayout: true
244
- },
245
- allowMediaGroup: false,
246
- isCopyPasteEnabled: true,
247
- editorSelectionAPI: editorSelectionAPI
248
- }]);
249
- }
250
- }
251
- if (props.collabEdit || props.collabEditProvider) {
252
- var _collabEditOptions$EX;
253
- var collabEditOptions = {
254
- sanitizePrivateContent: props.sanitizePrivateContent,
255
- createAnalyticsEvent: createAnalyticsEvent
256
- };
257
- if (props.collabEdit) {
258
- collabEditOptions = _objectSpread(_objectSpread({}, props.collabEdit), collabEditOptions);
259
- }
260
- preset.add([_plugins.collabEditPlugin, _objectSpread(_objectSpread({}, collabEditOptions), {}, {
261
- EXPERIMENTAL_allowInternalErrorAnalytics: (_collabEditOptions$EX = collabEditOptions.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _collabEditOptions$EX !== void 0 ? _collabEditOptions$EX : (0, _utils.shouldForceTracking)()
262
- })]);
263
- }
264
- if (props.maxContentSize) {
265
- preset.add([_plugins.maxContentSizePlugin, props.maxContentSize]);
266
- }
267
- if (props.allowJiraIssue) {
268
- preset.add(_plugins.jiraIssuePlugin);
269
- }
270
- if (props.allowPanel) {
271
- preset.add([_plugins.panelPlugin, {
272
- useLongPressSelection: false,
273
- allowCustomPanel: props.allowPanel.allowCustomPanel,
274
- allowCustomPanelEdit: props.allowPanel.allowCustomPanelEdit
275
- }]);
276
- }
277
- if (props.allowExtension) {
278
- var extensionConfig = (0, _typeof2.default)(props.allowExtension) === 'object' ? props.allowExtension : {};
279
- preset.add([_plugins.extensionPlugin, {
280
- breakoutEnabled: props.appearance === 'full-page' && extensionConfig.allowBreakout !== false,
281
- allowAutoSave: extensionConfig.allowAutoSave,
282
- extensionHandlers: props.extensionHandlers,
283
- useLongPressSelection: false,
284
- appearance: appearance
285
- }]);
286
- }
287
- if (props.macroProvider) {
288
- preset.add(_plugins.macroPlugin);
289
- }
290
-
291
- // See default list for when adding annotations with a provider
292
- if (!props.annotationProviders && props.allowConfluenceInlineComment) {
293
- preset.add([_plugins.annotationPlugin, undefined]);
294
- }
295
- if (props.allowDate) {
296
- preset.add(_plugins.datePlugin);
297
- }
298
- if (props.allowTemplatePlaceholders) {
299
- var options = props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {};
300
- preset.add([_plugins.placeholderTextPlugin, options]);
301
- }
302
- if (props.allowLayouts) {
303
- preset.add([_plugins.layoutPlugin, _objectSpread(_objectSpread({}, typeof props.allowLayouts === 'boolean' ? {} : props.allowLayouts), {}, {
304
- useLongPressSelection: false,
305
- UNSAFE_allowSingleColumnLayout: props.allowLayouts.UNSAFE_allowSingleColumnLayout
306
- })]);
307
- }
308
- if ((_props$linking3 = props.linking) !== null && _props$linking3 !== void 0 && _props$linking3.smartLinks || props.smartLinks || props.UNSAFE_cards) {
309
- var _props$linking4, _props$linking5;
310
- var fullWidthMode = props.appearance === 'full-width';
311
- preset.add([_plugins.cardPlugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking4 = props.linking) === null || _props$linking4 === void 0 ? void 0 : _props$linking4.smartLinks), {}, {
312
- platform: isMobile ? 'mobile' : 'web',
313
- fullWidthMode: fullWidthMode,
314
- createAnalyticsEvent: createAnalyticsEvent,
315
- linkPicker: (_props$linking5 = props.linking) === null || _props$linking5 === void 0 ? void 0 : _props$linking5.linkPicker
316
- })]);
317
- }
318
- if (props.autoformattingProvider) {
319
- preset.add(_plugins.customAutoformatPlugin);
320
- }
321
- var statusMenuDisabled = true;
322
- if (props.allowStatus) {
323
- statusMenuDisabled = (0, _typeof2.default)(props.allowStatus) === 'object' ? props.allowStatus.menuDisabled : false;
324
- preset.add([_plugins.statusPlugin, {
325
- menuDisabled: statusMenuDisabled,
326
- allowZeroWidthSpaceAfter: !isMobile
327
- }]);
328
- }
329
- if (props.allowIndentation) {
330
- preset.add(_plugins.indentationPlugin);
331
- }
332
- if (isFullPage) {
333
- preset.add(_plugins.contextPanelPlugin);
334
- }
335
- if (props.autoScrollIntoView !== false) {
336
- preset.add(_plugins.scrollIntoViewPlugin);
337
- }
338
- if (isMobile || props.allowUndoRedoButtons) {
339
- preset.add(_plugins.historyPlugin);
340
- }
341
- if (isMobile) {
342
- preset.add(_plugins.mobileDimensionsPlugin);
343
- preset.add(_plugins.mobileSelectionPlugin);
344
- }
345
-
346
- // UI only plugins
347
- preset.add([_plugins.toolbarListsIndentationPlugin, {
348
- showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
349
- allowHeadingAndParagraphIndentation: !!props.allowIndentation
350
- }]);
351
- preset.add([_plugins.insertBlockPlugin, {
352
- allowTables: !!props.allowTables,
353
- allowExpand: (0, _plugins.isExpandInsertionEnabled)(props),
354
- insertMenuItems: props.insertMenuItems,
355
- horizontalRuleEnabled: props.allowRule,
356
- nativeStatusSupported: !statusMenuDisabled,
357
- showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
358
- replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false,
359
- insertNodeAPI: insertNodeAPI
360
- }]);
361
- var hasBeforePrimaryToolbar = function hasBeforePrimaryToolbar(components) {
362
- if (components && 'before' in components) {
363
- return !!components.before;
364
- }
365
- return false;
366
- };
367
- if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
368
- preset.add([_plugins.beforePrimaryToolbarPlugin, {
369
- beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
370
- }]);
371
- }
372
- if (featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
373
- preset.add([_plugins.avatarGroupPlugin, {
374
- collabEdit: props.collabEdit,
375
- takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
376
- }]);
377
- }
378
- if (props.allowFindReplace) {
379
- preset.add([_plugins.findReplacePlugin, {
380
- takeFullWidth: !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
381
- twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
382
- }]);
383
- }
384
- if (props.allowFragmentMark) {
385
- preset.add(_plugins.fragmentMarkPlugin);
386
- }
387
- if (featureFlags.enableViewUpdateSubscription) {
388
- preset.add(_plugins.viewUpdateSubscriptionPlugin);
389
- }
390
- preset.add([_plugins.codeBidiWarningPlugin, {
391
- appearance: props.appearance
392
- }]);
393
- if (featureFlags.floatingToolbarCopyButton) {
394
- preset.add(_plugins.copyButtonPlugin);
395
- }
114
+ var preset = (0, _universal.default)(props.appearance, getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent), (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props), prevProps === null || prevProps === void 0 ? void 0 : prevProps.appearance, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth);
396
115
  var excludes = new Set();
397
116
  if (!isCodeBlockAllowed({
398
117
  allowBlockType: props.allowBlockType
@@ -35,10 +35,10 @@ var _EditorContext = _interopRequireDefault(require("./ui/EditorContext"));
35
35
  var _PortalProvider = require("./ui/PortalProvider");
36
36
  var _contextAdapter = require("./nodeviews/context-adapter");
37
37
  var _measureEnum = _interopRequireDefault(require("./utils/performance/measure-enum"));
38
- var _extensions2 = require("./utils/extensions");
38
+ var _prepareQuickInsertProvider = _interopRequireDefault(require("./utils/prepare-quick-insert-provider"));
39
39
  var _analytics = require("./plugins/analytics");
40
40
  var _ErrorBoundary = _interopRequireDefault(require("./create-editor/ErrorBoundary"));
41
- var _featureFlagsFromProps = require("./plugins/feature-flags-context/feature-flags-from-props");
41
+ var _featureFlagsFromProps = require("./create-editor/feature-flags-from-props");
42
42
  var _RenderTracking = require("./utils/performance/components/RenderTracking");
43
43
  var _templateObject;
44
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -66,9 +66,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
66
66
  return (0, _extensions.combineExtensionProviders)(extensionProviders);
67
67
  }));
68
68
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "prepareQuickInsertProvider", function (extensionProvider, quickInsert) {
69
- var quickInsertProvider = quickInsert && typeof quickInsert !== 'boolean' && quickInsert.provider;
70
- var extensionQuickInsertProvider = extensionProvider && (0, _extensions2.extensionProviderToQuickInsertProvider)(extensionProvider, _this.editorActions, _this.createAnalyticsEvent);
71
- return quickInsertProvider && extensionQuickInsertProvider ? (0, _extensions2.combineQuickInsertProviders)([quickInsertProvider, extensionQuickInsertProvider]) : quickInsertProvider || extensionQuickInsertProvider;
69
+ return (0, _prepareQuickInsertProvider.default)(_this.editorActions, extensionProvider, quickInsert, _this.createAnalyticsEvent);
72
70
  });
73
71
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSave", function (view) {
74
72
  if (!_this.props.onSave) {
@@ -128,10 +126,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
128
126
  }, (_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);
129
127
  }
130
128
  var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
131
- var _quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
129
+ var quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
132
130
  _this.state = {
133
131
  extensionProvider: _extensionProvider,
134
- quickInsertProvider: _quickInsertProvider
132
+ quickInsertProvider: quickInsertProvider
135
133
  };
136
134
  return _this;
137
135
  }
@@ -180,6 +178,13 @@ var Editor = /*#__PURE__*/function (_React$Component) {
180
178
  });
181
179
  }
182
180
  }
181
+
182
+ /**
183
+ * @private
184
+ * @deprecated - Do not override this at all, this is an anti-pattern.
185
+ * Please reach out to the Editor team if you were previously using this
186
+ * and need to find a workaround.
187
+ */
183
188
  }, {
184
189
  key: "trackEditorActions",
185
190
  value: function trackEditorActions(editorActions, props) {
@@ -266,9 +271,23 @@ var Editor = /*#__PURE__*/function (_React$Component) {
266
271
  }
267
272
  return editorActions;
268
273
  }
274
+
275
+ /**
276
+ * @private
277
+ * @deprecated - Do not override this at all, this is an antipattern.
278
+ * Please reach out to the Editor team if you were previously using this
279
+ * and need to find a workaround.
280
+ */
269
281
  }, {
270
282
  key: "onEditorCreated",
271
- value: function onEditorCreated(instance) {
283
+ value:
284
+ /**
285
+ * @private
286
+ * @deprecated - Do not override this at all, this is an antipattern.
287
+ * Please reach out to the Editor team if you were previously using this
288
+ * and need to find a workaround.
289
+ */
290
+ function onEditorCreated(instance) {
272
291
  var _this$props$featureFl2;
273
292
  this.registerEditorForActions(instance.view, instance.eventDispatcher, instance.transformer);
274
293
  if ((_this$props$featureFl2 = this.props.featureFlags) !== null && _this$props$featureFl2 !== void 0 && _this$props$featureFl2.ufo) {
@@ -372,6 +391,13 @@ var Editor = /*#__PURE__*/function (_React$Component) {
372
391
  console.warn("\"allowMoreTextColors\" field of \"allowTextColor\" property is deprecated. It will be removedin editor-core@".concat(nextVersion, ". The color palette now shows more colors by default."));
373
392
  }
374
393
  }
394
+
395
+ /**
396
+ * @private
397
+ * @deprecated - Do not override this at all, this is an antipattern.
398
+ * Please reach out to the Editor team if you were previously using this
399
+ * and need to find a workaround.
400
+ */
375
401
  }, {
376
402
  key: "onEditorDestroyed",
377
403
  value: function onEditorDestroyed(_instance) {
@@ -443,6 +469,13 @@ var Editor = /*#__PURE__*/function (_React$Component) {
443
469
  value: function getBaseFontSize() {
444
470
  return !['comment', 'chromeless', 'mobile'].includes(this.props.appearance) ? _editorSharedStyles.akEditorFullPageDefaultFontSize : undefined;
445
471
  }
472
+
473
+ /**
474
+ * @private
475
+ * @deprecated - Do not override this at all, this is an antipattern.
476
+ * Please reach out to the Editor team if you were previously using this
477
+ * and need to find a workaround.
478
+ */
446
479
  }, {
447
480
  key: "render",
448
481
  value: function render() {