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