@atlaskit/editor-core 191.4.3 → 191.4.6
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 +13 -0
- package/dist/cjs/presets/default.js +14 -33
- package/dist/cjs/presets/universal.js +94 -304
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/presets/default.js +14 -35
- package/dist/es2019/presets/universal.js +101 -314
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/presets/default.js +14 -33
- package/dist/esm/presets/universal.js +94 -304
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/presets/default.d.ts +1403 -329
- package/dist/types-ts4.5/presets/default.d.ts +1740 -374
- package/package.json +10 -13
|
@@ -23,7 +23,6 @@ import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
|
|
|
23
23
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
24
24
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
25
25
|
import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
|
|
26
|
-
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
27
26
|
import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
|
|
28
27
|
import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
|
|
29
28
|
import { insertBlockPlugin } from '@atlaskit/editor-plugin-insert-block';
|
|
@@ -60,7 +59,7 @@ import { createDefaultPreset } from './default';
|
|
|
60
59
|
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
61
60
|
*/
|
|
62
61
|
export default function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent) {
|
|
63
|
-
var _featureFlags$lpLinkP;
|
|
62
|
+
var _featureFlags$lpLinkP, _props$media, _props$media2, _props$media3, _props$media4, _props$media5, _props$mention$insert, _props$mention, _props$mention2, _props$collabEdit$EXP, _props$collabEdit, _props$linking, _props$linking2, _featureFlags$lpLinkP2, _props$linking3, _props$primaryToolbar;
|
|
64
63
|
const isMobile = appearance === 'mobile';
|
|
65
64
|
const isComment = appearance === 'comment';
|
|
66
65
|
const isChromeless = appearance === 'chromeless';
|
|
@@ -68,6 +67,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
68
67
|
const getEditorFeatureFlags = () => featureFlags;
|
|
69
68
|
const defaultPreset = createDefaultPreset({
|
|
70
69
|
...props,
|
|
70
|
+
appearance,
|
|
71
71
|
createAnalyticsEvent,
|
|
72
72
|
hyperlinkOptions: {
|
|
73
73
|
lpLinkPicker: (_featureFlags$lpLinkP = featureFlags.lpLinkPicker) !== null && _featureFlags$lpLinkP !== void 0 ? _featureFlags$lpLinkP : false,
|
|
@@ -81,286 +81,92 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
81
81
|
}
|
|
82
82
|
return false;
|
|
83
83
|
};
|
|
84
|
-
const finalPreset = defaultPreset.add(dataConsumerPlugin).add(contentInsertionPlugin).maybeAdd(breakoutPlugin,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}).maybeAdd(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}]);
|
|
171
|
-
}
|
|
172
|
-
return builder;
|
|
173
|
-
}).maybeAdd(emojiPlugin, (plugin, builder) => {
|
|
174
|
-
if (props.emojiProvider) {
|
|
175
|
-
return builder.add(plugin);
|
|
176
|
-
}
|
|
177
|
-
return builder;
|
|
178
|
-
}).maybeAdd(tablesPlugin, (plugin, builder) => {
|
|
179
|
-
if (props.allowTables) {
|
|
180
|
-
const tableOptions = !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables;
|
|
181
|
-
return builder.add([plugin, {
|
|
182
|
-
tableOptions,
|
|
183
|
-
// tableResizingEnabled will replace breakoutEnabled once FF is 100% rolled out,
|
|
184
|
-
// logic below is to help codemod during cleanup
|
|
185
|
-
tableResizingEnabled: getBooleanFF('platform.editor.custom-table-width') && ['full-page', 'full-width'].includes(appearance || ''),
|
|
186
|
-
dragAndDropEnabled: getBooleanFF('platform.editor.table.drag-and-drop') && isFullPage,
|
|
187
|
-
breakoutEnabled: appearance === 'full-page',
|
|
188
|
-
allowContextualMenu: !isMobile,
|
|
189
|
-
fullWidthEnabled: appearance === 'full-width',
|
|
190
|
-
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
191
|
-
getEditorFeatureFlags
|
|
192
|
-
}]);
|
|
193
|
-
}
|
|
194
|
-
return builder;
|
|
195
|
-
}).maybeAdd(tasksAndDecisionsPlugin, (plugin, builder) => {
|
|
196
|
-
if (props.allowTasksAndDecisions || props.taskDecisionProvider) {
|
|
197
|
-
return builder.add([plugin, {
|
|
198
|
-
allowNestedTasks: props.allowNestedTasks,
|
|
199
|
-
consumeTabs: isFullPage,
|
|
200
|
-
useLongPressSelection: false
|
|
201
|
-
}]);
|
|
202
|
-
}
|
|
203
|
-
return builder;
|
|
204
|
-
}).maybeAdd(feedbackDialogPlugin, (plugin, builder) => {
|
|
205
|
-
if (props.feedbackInfo) {
|
|
206
|
-
return builder.add([plugin, {
|
|
207
|
-
coreVersion,
|
|
208
|
-
...props.feedbackInfo
|
|
209
|
-
}]);
|
|
210
|
-
}
|
|
211
|
-
return builder;
|
|
212
|
-
}).maybeAdd(helpDialogPlugin, (plugin, builder) => {
|
|
213
|
-
if (props.allowHelpDialog) {
|
|
214
|
-
return builder.add([plugin, !!props.legacyImageUploadProvider]);
|
|
215
|
-
}
|
|
216
|
-
return builder;
|
|
217
|
-
}).maybeAdd(saveOnEnterPlugin, (plugin, builder) => {
|
|
218
|
-
if (props.saveOnEnter && props.onSave) {
|
|
219
|
-
return builder.add([plugin, props.onSave]);
|
|
220
|
-
}
|
|
221
|
-
return builder;
|
|
222
|
-
}).maybeAdd(imageUploadPlugin, (plugin, builder) => {
|
|
223
|
-
if (props.legacyImageUploadProvider) {
|
|
224
|
-
return builder.add(plugin);
|
|
225
|
-
}
|
|
226
|
-
return builder;
|
|
227
|
-
}).maybeAdd(mediaPlugin, (plugin, builder) => {
|
|
228
|
-
if (props.legacyImageUploadProvider && !props.media) {
|
|
229
|
-
return builder.add([plugin, {
|
|
230
|
-
allowMediaSingle: {
|
|
231
|
-
disableLayout: true
|
|
232
|
-
},
|
|
233
|
-
allowMediaGroup: false,
|
|
234
|
-
isCopyPasteEnabled: true
|
|
235
|
-
}]);
|
|
236
|
-
}
|
|
237
|
-
return builder;
|
|
238
|
-
}).maybeAdd(collabEditPlugin, (plugin, builder) => {
|
|
239
|
-
if (props.collabEdit || props.collabEditProvider) {
|
|
240
|
-
var _collabEditOptions$EX;
|
|
241
|
-
let collabEditOptions = {
|
|
242
|
-
sanitizePrivateContent: props.sanitizePrivateContent
|
|
243
|
-
};
|
|
244
|
-
if (props.collabEdit) {
|
|
245
|
-
collabEditOptions = {
|
|
246
|
-
...props.collabEdit,
|
|
247
|
-
...collabEditOptions
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return builder.add([plugin, {
|
|
251
|
-
...collabEditOptions,
|
|
252
|
-
EXPERIMENTAL_allowInternalErrorAnalytics: (_collabEditOptions$EX = collabEditOptions.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _collabEditOptions$EX !== void 0 ? _collabEditOptions$EX : shouldForceTracking()
|
|
253
|
-
}]);
|
|
254
|
-
}
|
|
255
|
-
return builder;
|
|
256
|
-
}).maybeAdd(maxContentSizePlugin, (plugin, builder) => {
|
|
257
|
-
if (props.maxContentSize) {
|
|
258
|
-
return builder.add([plugin, props.maxContentSize]);
|
|
259
|
-
}
|
|
260
|
-
return builder;
|
|
261
|
-
}).maybeAdd(panelPlugin, (plugin, builder) => {
|
|
262
|
-
if (props.allowPanel) {
|
|
263
|
-
const allowPanel = typeof props.allowPanel === 'object' ? props.allowPanel : {};
|
|
264
|
-
return builder.add([plugin, {
|
|
265
|
-
useLongPressSelection: false,
|
|
266
|
-
allowCustomPanel: allowPanel.allowCustomPanel,
|
|
267
|
-
allowCustomPanelEdit: allowPanel.allowCustomPanelEdit
|
|
268
|
-
}]);
|
|
269
|
-
}
|
|
270
|
-
return builder;
|
|
271
|
-
}).maybeAdd(contextPanelPlugin, (plugin, builder) => {
|
|
272
|
-
if (isFullPage) {
|
|
273
|
-
return builder.add(contextPanelPlugin);
|
|
274
|
-
}
|
|
275
|
-
return builder;
|
|
276
|
-
}).maybeAdd(extensionPlugin, (plugin, builder) => {
|
|
277
|
-
if (props.allowExtension) {
|
|
278
|
-
const extensionConfig = typeof props.allowExtension === 'object' ? props.allowExtension : {};
|
|
279
|
-
return builder.add([plugin, {
|
|
280
|
-
breakoutEnabled: appearance === 'full-page' && extensionConfig.allowBreakout !== false,
|
|
281
|
-
allowAutoSave: extensionConfig.allowAutoSave,
|
|
282
|
-
extensionHandlers: props.extensionHandlers,
|
|
283
|
-
useLongPressSelection: false,
|
|
284
|
-
appearance
|
|
285
|
-
}]);
|
|
286
|
-
}
|
|
287
|
-
return builder;
|
|
288
|
-
}).maybeAdd(annotationPlugin, (plugin, builder) => {
|
|
289
|
-
// See default list for when adding annotations with a provider
|
|
290
|
-
if (!props.annotationProviders && props.allowConfluenceInlineComment) {
|
|
291
|
-
return builder.add([plugin, undefined]);
|
|
292
|
-
}
|
|
293
|
-
return builder;
|
|
294
|
-
}).maybeAdd(datePlugin, (plugin, builder) => {
|
|
295
|
-
if (props.allowDate) {
|
|
296
|
-
const dateConfig = typeof props.allowDate === 'object' ? props.allowDate : {};
|
|
297
|
-
return builder.add([plugin, {
|
|
298
|
-
weekStartDay: dateConfig.weekStartDay
|
|
299
|
-
}]);
|
|
300
|
-
}
|
|
301
|
-
return builder;
|
|
302
|
-
}).maybeAdd(placeholderTextPlugin, (plugin, builder) => {
|
|
303
|
-
if (props.allowTemplatePlaceholders) {
|
|
304
|
-
const options = props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {};
|
|
305
|
-
return builder.add([plugin, options]);
|
|
306
|
-
}
|
|
307
|
-
return builder;
|
|
308
|
-
}).maybeAdd(layoutPlugin, (plugin, builder) => {
|
|
309
|
-
if (props.allowLayouts) {
|
|
310
|
-
const layoutOptions = typeof props.allowLayouts === 'object' ? props.allowLayouts : {};
|
|
311
|
-
return builder.add([plugin, {
|
|
312
|
-
...layoutOptions,
|
|
313
|
-
useLongPressSelection: false,
|
|
314
|
-
UNSAFE_allowSingleColumnLayout: layoutOptions.UNSAFE_allowSingleColumnLayout
|
|
315
|
-
}]);
|
|
316
|
-
}
|
|
317
|
-
return builder;
|
|
318
|
-
}).maybeAdd(cardPlugin, (plugin, builder) => {
|
|
319
|
-
var _props$linking;
|
|
320
|
-
if ((_props$linking = props.linking) !== null && _props$linking !== void 0 && _props$linking.smartLinks || props.smartLinks || props.UNSAFE_cards) {
|
|
321
|
-
var _props$linking2, _props$linking3, _featureFlags$lpLinkP2;
|
|
322
|
-
const fullWidthMode = appearance === 'full-width';
|
|
323
|
-
return builder.add([plugin, {
|
|
324
|
-
...props.UNSAFE_cards,
|
|
325
|
-
...props.smartLinks,
|
|
326
|
-
...((_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.smartLinks),
|
|
327
|
-
platform: isMobile ? 'mobile' : 'web',
|
|
328
|
-
fullWidthMode,
|
|
329
|
-
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker,
|
|
330
|
-
lpLinkPicker: (_featureFlags$lpLinkP2 = featureFlags.lpLinkPicker) !== null && _featureFlags$lpLinkP2 !== void 0 ? _featureFlags$lpLinkP2 : false,
|
|
331
|
-
editorAppearance: appearance
|
|
332
|
-
}]);
|
|
333
|
-
}
|
|
334
|
-
return builder;
|
|
335
|
-
}).maybeAdd(customAutoformatPlugin, (plugin, builder) => {
|
|
336
|
-
if (props.autoformattingProvider) {
|
|
337
|
-
return builder.add(plugin);
|
|
338
|
-
}
|
|
339
|
-
return builder;
|
|
340
|
-
}).maybeAdd(statusPlugin, (plugin, builder) => {
|
|
341
|
-
if (props.allowStatus) {
|
|
342
|
-
return builder.add([plugin, {
|
|
343
|
-
menuDisabled: statusMenuDisabled,
|
|
344
|
-
allowZeroWidthSpaceAfter: !isMobile
|
|
345
|
-
}]);
|
|
346
|
-
}
|
|
347
|
-
return builder;
|
|
348
|
-
}).maybeAdd(indentationPlugin, (plugin, builder) => {
|
|
349
|
-
if (props.allowIndentation) {
|
|
350
|
-
return builder.add(plugin);
|
|
351
|
-
}
|
|
352
|
-
return builder;
|
|
353
|
-
}).maybeAdd(scrollIntoViewPlugin, (plugin, builder) => {
|
|
354
|
-
if (props.autoScrollIntoView !== false) {
|
|
355
|
-
return builder.add(scrollIntoViewPlugin);
|
|
356
|
-
}
|
|
357
|
-
return builder;
|
|
358
|
-
}).maybeAdd(historyPlugin, (plugin, builder) => {
|
|
359
|
-
if (isMobile || props.allowUndoRedoButtons) {
|
|
360
|
-
return builder.add(historyPlugin);
|
|
361
|
-
}
|
|
362
|
-
return builder;
|
|
363
|
-
}).add([toolbarListsIndentationPlugin, {
|
|
84
|
+
const finalPreset = defaultPreset.add(dataConsumerPlugin).add(contentInsertionPlugin).maybeAdd([breakoutPlugin, {
|
|
85
|
+
allowBreakoutButton: appearance === 'full-page'
|
|
86
|
+
}], Boolean(props.allowBreakout && isFullPage)).maybeAdd(alignmentPlugin, Boolean(props.allowTextAlignment)).maybeAdd([textColorPlugin, props.allowTextColor], Boolean(props.allowTextColor)).add(listPlugin).maybeAdd(rulePlugin, Boolean(props.allowRule)).maybeAdd([expandPlugin, {
|
|
87
|
+
allowInsertion: isExpandInsertionEnabled(props),
|
|
88
|
+
useLongPressSelection: false,
|
|
89
|
+
appearance: appearance,
|
|
90
|
+
allowInteractiveExpand: featureFlags.interactiveExpand
|
|
91
|
+
}], Boolean(props.allowExpand)).maybeAdd(guidelinePlugin, Boolean(!isMobile && !isComment && !isChromeless && (props.media || props.allowTables))).maybeAdd([gridPlugin, {
|
|
92
|
+
shouldCalcBreakoutGridLines: isFullPage
|
|
93
|
+
}], Boolean(props.media)).maybeAdd([mediaPlugin, {
|
|
94
|
+
...props.media,
|
|
95
|
+
allowLazyLoading: !isMobile,
|
|
96
|
+
allowBreakoutSnapPoints: isFullPage,
|
|
97
|
+
allowAdvancedToolBarOptions: typeof ((_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.allowAdvancedToolBarOptions) !== 'undefined' ? (_props$media2 = props.media) === null || _props$media2 === void 0 ? void 0 : _props$media2.allowAdvancedToolBarOptions : isFullPage || isComment,
|
|
98
|
+
allowDropzoneDropLine: isFullPage,
|
|
99
|
+
allowMediaSingleEditable: !isMobile,
|
|
100
|
+
allowRemoteDimensionsFetch: !isMobile,
|
|
101
|
+
allowMarkingUploadsAsIncomplete: isMobile,
|
|
102
|
+
fullWidthEnabled: appearance === 'full-width',
|
|
103
|
+
uploadErrorHandler: props.uploadErrorHandler,
|
|
104
|
+
waitForMediaUpload: props.waitForMediaUpload,
|
|
105
|
+
isCopyPasteEnabled: !isMobile,
|
|
106
|
+
alignLeftOnInsert: typeof ((_props$media3 = props.media) === null || _props$media3 === void 0 ? void 0 : _props$media3.alignLeftOnInsert) !== 'undefined' ? (_props$media4 = props.media) === null || _props$media4 === void 0 ? void 0 : _props$media4.alignLeftOnInsert : isComment,
|
|
107
|
+
getEditorFeatureFlags
|
|
108
|
+
}], Boolean(props.media)).maybeAdd(captionPlugin, Boolean((_props$media5 = props.media) === null || _props$media5 === void 0 ? void 0 : _props$media5.allowCaptions)).maybeAdd([mentionsPlugin, {
|
|
109
|
+
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
110
|
+
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,
|
|
111
|
+
allowZeroWidthSpaceAfter: !isMobile,
|
|
112
|
+
HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent
|
|
113
|
+
}], Boolean(props.mentionProvider)).maybeAdd(emojiPlugin, Boolean(props.emojiProvider)).maybeAdd([tablesPlugin, {
|
|
114
|
+
tableOptions: !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables,
|
|
115
|
+
tableResizingEnabled: getBooleanFF('platform.editor.custom-table-width') && ['full-page', 'full-width'].includes(appearance || ''),
|
|
116
|
+
dragAndDropEnabled: getBooleanFF('platform.editor.table.drag-and-drop') && isFullPage,
|
|
117
|
+
breakoutEnabled: appearance === 'full-page',
|
|
118
|
+
allowContextualMenu: !isMobile,
|
|
119
|
+
fullWidthEnabled: appearance === 'full-width',
|
|
120
|
+
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
121
|
+
getEditorFeatureFlags
|
|
122
|
+
}], Boolean(props.allowTables)).maybeAdd([tasksAndDecisionsPlugin, {
|
|
123
|
+
allowNestedTasks: props.allowNestedTasks,
|
|
124
|
+
consumeTabs: isFullPage,
|
|
125
|
+
useLongPressSelection: false
|
|
126
|
+
}], Boolean(props.allowTasksAndDecisions || props.taskDecisionProvider)).maybeAdd([feedbackDialogPlugin, {
|
|
127
|
+
coreVersion,
|
|
128
|
+
...props.feedbackInfo
|
|
129
|
+
}], Boolean(props.feedbackInfo)).maybeAdd([helpDialogPlugin, !!props.legacyImageUploadProvider], Boolean(props.allowHelpDialog)).maybeAdd([saveOnEnterPlugin, props.onSave], Boolean(props.saveOnEnter && props.onSave)).maybeAdd(imageUploadPlugin, Boolean(props.legacyImageUploadProvider)).maybeAdd([mediaPlugin, {
|
|
130
|
+
allowMediaSingle: {
|
|
131
|
+
disableLayout: true
|
|
132
|
+
},
|
|
133
|
+
allowMediaGroup: false,
|
|
134
|
+
isCopyPasteEnabled: true
|
|
135
|
+
}], Boolean(props.legacyImageUploadProvider && !props.media)).maybeAdd([collabEditPlugin, {
|
|
136
|
+
...props.collabEdit,
|
|
137
|
+
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
138
|
+
EXPERIMENTAL_allowInternalErrorAnalytics: (_props$collabEdit$EXP = (_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _props$collabEdit$EXP !== void 0 ? _props$collabEdit$EXP : shouldForceTracking()
|
|
139
|
+
}], Boolean(props.collabEdit || props.collabEditProvider)).maybeAdd([maxContentSizePlugin, props.maxContentSize], Boolean(props.maxContentSize)).maybeAdd([panelPlugin, {
|
|
140
|
+
useLongPressSelection: false,
|
|
141
|
+
allowCustomPanel: typeof props.allowPanel === 'object' ? props.allowPanel.allowCustomPanel : false,
|
|
142
|
+
allowCustomPanelEdit: typeof props.allowPanel === 'object' ? props.allowPanel.allowCustomPanelEdit : false
|
|
143
|
+
}], Boolean(props.allowPanel)).maybeAdd(contextPanelPlugin, Boolean(isFullPage)).maybeAdd([extensionPlugin, {
|
|
144
|
+
breakoutEnabled: appearance === 'full-page' && (typeof props.allowExtension === 'object' ? props.allowExtension.allowBreakout : true) !== false,
|
|
145
|
+
allowAutoSave: typeof props.allowExtension === 'object' ? props.allowExtension.allowAutoSave : false,
|
|
146
|
+
extensionHandlers: props.extensionHandlers,
|
|
147
|
+
useLongPressSelection: false,
|
|
148
|
+
appearance
|
|
149
|
+
}], Boolean(props.allowExtension)).maybeAdd([annotationPlugin, undefined], Boolean(!props.annotationProviders && props.allowConfluenceInlineComment)).maybeAdd([datePlugin, {
|
|
150
|
+
weekStartDay: typeof props.allowDate === 'object' ? props.allowDate.weekStartDay : undefined
|
|
151
|
+
}], Boolean(props.allowDate)).maybeAdd([placeholderTextPlugin,
|
|
152
|
+
// @ts-expect-error 2322: Type 'false | PlaceholderTextOptions | undefined'
|
|
153
|
+
props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {}], Boolean(props.allowTemplatePlaceholders)).maybeAdd([layoutPlugin, {
|
|
154
|
+
...(typeof props.allowLayouts === 'object' ? props.allowLayouts : {}),
|
|
155
|
+
useLongPressSelection: false,
|
|
156
|
+
UNSAFE_allowSingleColumnLayout: typeof props.allowLayouts === 'object' ? props.allowLayouts.UNSAFE_allowSingleColumnLayout : undefined
|
|
157
|
+
}], Boolean(props.allowLayouts)).maybeAdd([cardPlugin, {
|
|
158
|
+
...props.UNSAFE_cards,
|
|
159
|
+
...props.smartLinks,
|
|
160
|
+
...((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks),
|
|
161
|
+
platform: isMobile ? 'mobile' : 'web',
|
|
162
|
+
fullWidthMode: appearance === 'full-width',
|
|
163
|
+
linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker,
|
|
164
|
+
lpLinkPicker: (_featureFlags$lpLinkP2 = featureFlags.lpLinkPicker) !== null && _featureFlags$lpLinkP2 !== void 0 ? _featureFlags$lpLinkP2 : false,
|
|
165
|
+
editorAppearance: appearance
|
|
166
|
+
}], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd(customAutoformatPlugin, Boolean(props.autoformattingProvider)).maybeAdd([statusPlugin, {
|
|
167
|
+
menuDisabled: statusMenuDisabled,
|
|
168
|
+
allowZeroWidthSpaceAfter: !isMobile
|
|
169
|
+
}], Boolean(props.allowStatus)).maybeAdd(indentationPlugin, Boolean(props.allowIndentation)).maybeAdd(scrollIntoViewPlugin, Boolean(props.autoScrollIntoView !== false)).add([toolbarListsIndentationPlugin, {
|
|
364
170
|
showIndentationButtons: !!props.showIndentationButtons,
|
|
365
171
|
allowHeadingAndParagraphIndentation: !!props.allowIndentation
|
|
366
172
|
}]).add([insertBlockPlugin, {
|
|
@@ -372,14 +178,10 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
372
178
|
nativeStatusSupported: !statusMenuDisabled,
|
|
373
179
|
showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
|
|
374
180
|
replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false
|
|
375
|
-
}]).maybeAdd(beforePrimaryToolbarPlugin,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}]);
|
|
380
|
-
}
|
|
381
|
-
return builder;
|
|
382
|
-
}).add([avatarGroupPlugin, {
|
|
181
|
+
}]).maybeAdd([beforePrimaryToolbarPlugin, {
|
|
182
|
+
beforePrimaryToolbarComponents: // @ts-expect-error 2339: Property 'before' does not exist on type 'PrimaryToolbarComponents'.
|
|
183
|
+
(_props$primaryToolbar = props.primaryToolbarComponents) === null || _props$primaryToolbar === void 0 ? void 0 : _props$primaryToolbar.before
|
|
184
|
+
}], Boolean(hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar)).add([avatarGroupPlugin, {
|
|
383
185
|
// Avatars are moved to Confluence codebase for Edit in Context
|
|
384
186
|
// When Edit in Context is enabled primaryToolbarComponents is undefined
|
|
385
187
|
// For more details please check
|
|
@@ -387,36 +189,21 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
387
189
|
collabEdit: props.collabEdit,
|
|
388
190
|
takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
|
|
389
191
|
showAvatarGroup: !props.hideAvatarGroup && featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar
|
|
390
|
-
}]).maybeAdd(findReplacePlugin,
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
twoLineEditorToolbar: !!props.primaryToolbarComponents && !!featureFlags.twoLineEditorToolbar
|
|
395
|
-
}]);
|
|
396
|
-
}
|
|
397
|
-
return builder;
|
|
398
|
-
}).maybeAdd(borderPlugin, (plugin, builder) => {
|
|
399
|
-
if (props.allowBorderMark || props.UNSAFE_allowBorderMark) {
|
|
400
|
-
return builder.add(plugin);
|
|
401
|
-
}
|
|
402
|
-
return builder;
|
|
403
|
-
}).maybeAdd(fragmentPlugin, (plugin, builder) => {
|
|
404
|
-
if (props.allowFragmentMark) {
|
|
405
|
-
return builder.add(plugin);
|
|
406
|
-
}
|
|
407
|
-
return builder;
|
|
408
|
-
}).maybeAdd(pasteOptionsToolbarPlugin, (plugin, builder) => {
|
|
192
|
+
}]).maybeAdd([findReplacePlugin, {
|
|
193
|
+
takeFullWidth: !props.hideAvatarGroup && !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
|
|
194
|
+
twoLineEditorToolbar: !!props.primaryToolbarComponents && !!featureFlags.twoLineEditorToolbar
|
|
195
|
+
}], Boolean(props.allowFindReplace)).maybeAdd(borderPlugin, Boolean(props.allowBorderMark || props.UNSAFE_allowBorderMark)).maybeAdd(fragmentPlugin, Boolean(props.allowFragmentMark)).maybeAdd(pasteOptionsToolbarPlugin, () => {
|
|
409
196
|
if (getBooleanFF('platform.editor.paste-options-toolbar')) {
|
|
410
|
-
return
|
|
197
|
+
return true;
|
|
411
198
|
}
|
|
412
|
-
return
|
|
199
|
+
return false;
|
|
413
200
|
}).add([codeBidiWarningPlugin, {
|
|
414
201
|
appearance
|
|
415
|
-
}]).maybeAdd(loomPlugin, (
|
|
202
|
+
}]).maybeAdd(loomPlugin, () => {
|
|
416
203
|
if (getBooleanFF('platform.editor.loom-integration')) {
|
|
417
|
-
return
|
|
204
|
+
return true;
|
|
418
205
|
}
|
|
419
|
-
return
|
|
206
|
+
return false;
|
|
420
207
|
});
|
|
421
208
|
return finalPreset;
|
|
422
209
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "191.4.
|
|
2
|
+
export const version = "191.4.6";
|
|
@@ -16,6 +16,7 @@ import { editorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
|
16
16
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
17
17
|
import { floatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
18
18
|
import { focusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
19
|
+
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
19
20
|
import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
20
21
|
import { pastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
21
22
|
import { placeholderPlugin } from '@atlaskit/editor-plugin-placeholder';
|
|
@@ -37,41 +38,21 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
37
38
|
* their placement in the editor toolbar
|
|
38
39
|
*/
|
|
39
40
|
export function createDefaultPreset(options) {
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([basePlugin, options.base]).add(decorationsPlugin).maybeAdd(undoRedoPlugin, function (p, builder) {
|
|
51
|
-
var _options$featureFlags;
|
|
52
|
-
// The undo redo plugin needs to be add before the blockTypePlugin
|
|
53
|
-
if ((_options$featureFlags = options.featureFlags) !== null && _options$featureFlags !== void 0 && _options$featureFlags.undoRedoButtons) {
|
|
54
|
-
return builder.add(p);
|
|
55
|
-
}
|
|
56
|
-
return builder;
|
|
57
|
-
}).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd(annotationPlugin, function (p, builder) {
|
|
58
|
-
if (options.annotationProviders) {
|
|
59
|
-
return builder.add([p, options.annotationProviders]);
|
|
60
|
-
}
|
|
61
|
-
return builder;
|
|
62
|
-
})
|
|
63
|
-
/**
|
|
64
|
-
* Do not use this plugin - it is for AI purposes only.
|
|
65
|
-
*/.maybeAdd(selectionToolbarPlugin, function (plugin, builder) {
|
|
41
|
+
var _options$featureFlags;
|
|
42
|
+
var isMobile = options.appearance === 'mobile';
|
|
43
|
+
var preset = new EditorPresetBuilder().add([featureFlagsPlugin, options.featureFlags || {}]).maybeAdd([analyticsPlugin, {
|
|
44
|
+
createAnalyticsEvent: options.createAnalyticsEvent,
|
|
45
|
+
performanceTracking: options.performanceTracking
|
|
46
|
+
}], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, options.paste]).add(clipboardPlugin).add(focusPlugin).add(compositionPlugin).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead || {
|
|
47
|
+
createAnalyticsEvent: options.createAnalyticsEvent
|
|
48
|
+
}]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = options.featureFlags) === null || _options$featureFlags === void 0 ? void 0 : _options$featureFlags.undoRedoButtons)).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([annotationPlugin, options.annotationProviders], Boolean(options.annotationProviders)).maybeAdd([selectionToolbarPlugin, {
|
|
49
|
+
preferenceToolbarAboveSelection: false
|
|
50
|
+
}], function () {
|
|
66
51
|
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
|
|
67
|
-
return
|
|
68
|
-
preferenceToolbarAboveSelection: false
|
|
69
|
-
}]);
|
|
52
|
+
return true;
|
|
70
53
|
}
|
|
71
|
-
return
|
|
72
|
-
}).add([hyperlinkPlugin, options.hyperlinkOptions]).add([textFormattingPlugin, options.textFormatting]).add(widthPlugin).add([quickInsertPlugin, options.quickInsert]).add([
|
|
73
|
-
createAnalyticsEvent: options.createAnalyticsEvent
|
|
74
|
-
}]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(copyButtonPlugin).add(floatingToolbarPlugin).add([selectionPlugin, options.selection]).add([codeBlockPlugin, options.codeBlock || {
|
|
54
|
+
return false;
|
|
55
|
+
}).add([hyperlinkPlugin, options.hyperlinkOptions]).add([textFormattingPlugin, options.textFormatting]).add(widthPlugin).add([quickInsertPlugin, options.quickInsert]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(copyButtonPlugin).add(floatingToolbarPlugin).add([selectionPlugin, options.selection]).add([codeBlockPlugin, options.codeBlock || {
|
|
75
56
|
appearance: 'full-page'
|
|
76
57
|
}]);
|
|
77
58
|
return preset;
|