UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

272 lines (270 loc) • 24.7 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = createUniversalPresetInternal; exports.isExpandInsertionEnabled = isExpandInsertionEnabled; var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _utils = require("@atlaskit/editor-common/utils"); var _accessibilityUtils = require("@atlaskit/editor-plugins/accessibility-utils"); var _alignment = require("@atlaskit/editor-plugins/alignment"); var _annotation = require("@atlaskit/editor-plugins/annotation"); var _avatarGroup = require("@atlaskit/editor-plugins/avatar-group"); var _batchAttributeUpdates = require("@atlaskit/editor-plugins/batch-attribute-updates"); var _beforePrimaryToolbar = require("@atlaskit/editor-plugins/before-primary-toolbar"); var _blockControls = require("@atlaskit/editor-plugins/block-controls"); var _border = require("@atlaskit/editor-plugins/border"); var _breakout = require("@atlaskit/editor-plugins/breakout"); var _caption = require("@atlaskit/editor-plugins/caption"); var _card = require("@atlaskit/editor-plugins/card"); var _codeBidiWarning = require("@atlaskit/editor-plugins/code-bidi-warning"); var _collabEdit = require("@atlaskit/editor-plugins/collab-edit"); var _contentInsertion = require("@atlaskit/editor-plugins/content-insertion"); var _contextPanel = require("@atlaskit/editor-plugins/context-panel"); var _customAutoformat = require("@atlaskit/editor-plugins/custom-autoformat"); var _dataConsumer = require("@atlaskit/editor-plugins/data-consumer"); var _date = require("@atlaskit/editor-plugins/date"); var _emoji = require("@atlaskit/editor-plugins/emoji"); var _expand = require("@atlaskit/editor-plugins/expand"); var _extension = require("@atlaskit/editor-plugins/extension"); var _feedbackDialog = require("@atlaskit/editor-plugins/feedback-dialog"); var _findReplace = require("@atlaskit/editor-plugins/find-replace"); var _fragment = require("@atlaskit/editor-plugins/fragment"); var _grid = require("@atlaskit/editor-plugins/grid"); var _guideline = require("@atlaskit/editor-plugins/guideline"); var _helpDialog = require("@atlaskit/editor-plugins/help-dialog"); var _imageUpload = require("@atlaskit/editor-plugins/image-upload"); var _indentation = require("@atlaskit/editor-plugins/indentation"); var _insertBlock = require("@atlaskit/editor-plugins/insert-block"); var _layout = require("@atlaskit/editor-plugins/layout"); var _list = require("@atlaskit/editor-plugins/list"); var _maxContentSize = require("@atlaskit/editor-plugins/max-content-size"); var _media = require("@atlaskit/editor-plugins/media"); var _mediaInsert = require("@atlaskit/editor-plugins/media-insert"); var _mentions = require("@atlaskit/editor-plugins/mentions"); var _panel = require("@atlaskit/editor-plugins/panel"); var _pasteOptionsToolbar = require("@atlaskit/editor-plugins/paste-options-toolbar"); var _placeholderText = require("@atlaskit/editor-plugins/placeholder-text"); var _rule = require("@atlaskit/editor-plugins/rule"); var _saveOnEnter = require("@atlaskit/editor-plugins/save-on-enter"); var _scrollIntoView = require("@atlaskit/editor-plugins/scroll-into-view"); var _status = require("@atlaskit/editor-plugins/status"); var _syncedBlock = require("@atlaskit/editor-plugins/synced-block"); var _table = require("@atlaskit/editor-plugins/table"); var _tasksAndDecisions = require("@atlaskit/editor-plugins/tasks-and-decisions"); var _textColor = require("@atlaskit/editor-plugins/text-color"); var _toolbarListsIndentation = require("@atlaskit/editor-plugins/toolbar-lists-indentation"); var _ufo = require("@atlaskit/editor-plugins/ufo"); var _platformFeatureFlags = require("@atlaskit/platform-feature-flags"); var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals"); var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure"); var _experiments = require("@atlaskit/tmp-editor-statsig/experiments"); var _isFullPage = require("../utils/is-full-page"); var _versionWrapper = require("../version-wrapper"); var _default = require("./default"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Mechanism to configuring plugins as the universal preset blocks direct access * to configuring plugins. * * Note: not all plugins are configurable via this mechanism, and for plugins configured -- it is only doing a subset of the configuration. */ /** * Creates a preset with all of the available plugins. * Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project) * with minimal friction. * * @param appearance * @param props A subset of full EditorProps for the full feature preset * @param featureFlags * @param prevAppearance The appearance of the editor in the previous render * @returns a full featured preset configured according to the provided props - basis for create-plugins-list */ function createUniversalPresetInternal(_ref) { var _initialPluginConfigu, _initialPluginConfigu2, _initialPluginConfigu3, _initialPluginConfigu4, _initialPluginConfigu5, _initialPluginConfigu6, _featureFlags$lpLinkP, _initialPluginConfigu7, _initialPluginConfigu8, _initialPluginConfigu9, _initialPluginConfigu0, _initialPluginConfigu1, _initialPluginConfigu10, _props$media, _props$media2, _props$media3, _props$media4, _props$media5, _props$media6, _props$media7, _props$mention$insert, _props$mention, _props$mention2, _props$mention3, _props$collabEdit$EXP, _props$collabEdit, _props$linking, _props$linking2, _featureFlags$lpLinkP2, _props$linking3, _props$primaryToolbar; var appearance = _ref.appearance, props = _ref.props, featureFlags = _ref.featureFlags, initialPluginConfiguration = _ref.initialPluginConfiguration, prevAppearance = _ref.prevAppearance, createAnalyticsEvent = _ref.createAnalyticsEvent; var isComment = appearance === 'comment'; var isChromeless = appearance === 'chromeless'; var isFullPage = (0, _isFullPage.isFullPage)(appearance); var getEditorFeatureFlags = function getEditorFeatureFlags() { return featureFlags; }; var defaultPreset = (0, _default.createDefaultPreset)(_objectSpread(_objectSpread({}, props), {}, { blockType: _objectSpread(_objectSpread({}, props.blockType), initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.blockTypePlugin), blockMenu: { enabled: (_initialPluginConfigu = initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu2 = initialPluginConfiguration.blockMenuPlugin) === null || _initialPluginConfigu2 === void 0 ? void 0 : _initialPluginConfigu2.enabled) !== null && _initialPluginConfigu !== void 0 ? _initialPluginConfigu : false, useStandardNodeWidth: (_initialPluginConfigu3 = initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu4 = initialPluginConfiguration.blockMenuPlugin) === null || _initialPluginConfigu4 === void 0 ? void 0 : _initialPluginConfigu4.useStandardNodeWidth) !== null && _initialPluginConfigu3 !== void 0 ? _initialPluginConfigu3 : false, blockLinkHashPrefix: initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu5 = initialPluginConfiguration.blockMenuPlugin) === null || _initialPluginConfigu5 === void 0 ? void 0 : _initialPluginConfigu5.blockLinkHashPrefix, getLinkPath: initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu6 = initialPluginConfiguration.blockMenuPlugin) === null || _initialPluginConfigu6 === void 0 ? void 0 : _initialPluginConfigu6.getLinkPath }, appearance: appearance, createAnalyticsEvent: createAnalyticsEvent, hyperlinkOptions: _objectSpread({ lpLinkPicker: (_featureFlags$lpLinkP = featureFlags.lpLinkPicker) !== null && _featureFlags$lpLinkP !== void 0 ? _featureFlags$lpLinkP : false }, props.hyperlinkOptions), __livePage: props.__livePage, toolbar: initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.toolbarPlugin })); var statusMenuDisabled = !props.allowStatus ? true : (0, _typeof2.default)(props.allowStatus) === 'object' ? Boolean(props.allowStatus.menuDisabled) : false; var hasBeforePrimaryToolbar = function hasBeforePrimaryToolbar(components) { if (components && 'before' in components) { return !!components.before; } return false; }; var finalPreset = defaultPreset.add(_ufo.ufoPlugin).add(_dataConsumer.dataConsumerPlugin).add(_accessibilityUtils.accessibilityUtilsPlugin).add(_contentInsertion.contentInsertionPlugin).add(_batchAttributeUpdates.batchAttributeUpdatesPlugin).maybeAdd([_blockControls.blockControlsPlugin, { quickInsertButtonEnabled: (_initialPluginConfigu7 = initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu8 = initialPluginConfiguration.blockControlsPlugin) === null || _initialPluginConfigu8 === void 0 ? void 0 : _initialPluginConfigu8.quickInsertButtonEnabled) !== null && _initialPluginConfigu7 !== void 0 ? _initialPluginConfigu7 : true, rightSideControlsEnabled: (_initialPluginConfigu9 = initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu0 = initialPluginConfiguration.blockControlsPlugin) === null || _initialPluginConfigu0 === void 0 ? void 0 : _initialPluginConfigu0.rightSideControlsEnabled) !== null && _initialPluginConfigu9 !== void 0 ? _initialPluginConfigu9 : false }], Boolean((_initialPluginConfigu1 = initialPluginConfiguration === null || initialPluginConfiguration === void 0 || (_initialPluginConfigu10 = initialPluginConfiguration.blockControlsPlugin) === null || _initialPluginConfigu10 === void 0 ? void 0 : _initialPluginConfigu10.enabled) !== null && _initialPluginConfigu1 !== void 0 ? _initialPluginConfigu1 : false)).maybeAdd([_breakout.breakoutPlugin, { allowBreakoutButton: appearance === 'full-page', appearance: appearance }], Boolean(props.allowBreakout && (isFullPage || appearance === 'max' && ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('confluence_max_width_content_appearance', 'isEnabled', true)) && (0, _platformFeatureFlags.fg)('platform_editor_breakout_in_universal_preset')))).maybeAdd(_alignment.alignmentPlugin, Boolean(props.allowTextAlignment)).maybeAdd([_textColor.textColorPlugin, props.allowTextColor], Boolean(props.allowTextColor)).add(_list.listPlugin).maybeAdd(_rule.rulePlugin, Boolean(props.allowRule)).maybeAdd([_expand.expandPlugin, { allowInsertion: isExpandInsertionEnabled(props), useLongPressSelection: false, appearance: appearance, allowInteractiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false), __livePage: props.__livePage }], Boolean(props.allowExpand)).maybeAdd(_guideline.guidelinePlugin, Boolean(!isComment && !isChromeless && (props.media || props.allowTables) || (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true, { exposure: true }) && (props.allowExpand || props.allowLayouts || props.codeBlock))).maybeAdd([_grid.gridPlugin, { shouldCalcBreakoutGridLines: isFullPage }], Boolean(props.media)).maybeAdd([_annotation.annotationPlugin, props.annotationProviders], Boolean(props.annotationProviders)).maybeAdd([_media.mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, { allowLazyLoading: true, allowBreakoutSnapPoints: isFullPage, 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, allowCommentsOnMedia: isFullPage && Boolean(props.annotationProviders), allowDropzoneDropLine: isFullPage, allowMediaSingleEditable: true, allowRemoteDimensionsFetch: true, allowMarkingUploadsAsIncomplete: false, allowImagePreview: typeof ((_props$media3 = props.media) === null || _props$media3 === void 0 ? void 0 : _props$media3.allowImagePreview) !== 'undefined' ? (_props$media4 = props.media) === null || _props$media4 === void 0 ? void 0 : _props$media4.allowImagePreview : isFullPage, fullWidthEnabled: appearance === 'full-width', editorAppearance: appearance, uploadErrorHandler: props.uploadErrorHandler, waitForMediaUpload: props.waitForMediaUpload, isCopyPasteEnabled: true, alignLeftOnInsert: typeof ((_props$media5 = props.media) === null || _props$media5 === void 0 ? void 0 : _props$media5.alignLeftOnInsert) !== 'undefined' ? (_props$media6 = props.media) === null || _props$media6 === void 0 ? void 0 : _props$media6.alignLeftOnInsert : isComment, getEditorFeatureFlags: getEditorFeatureFlags })], Boolean(props.media)).maybeAdd(_mediaInsert.mediaInsertPlugin, Boolean(props.media)).maybeAdd(_caption.captionPlugin, Boolean((_props$media7 = props.media) === null || _props$media7 === void 0 ? void 0 : _props$media7.allowCaptions)).maybeAdd([_mentions.mentionsPlugin, _objectSpread({ sanitizePrivateContent: props.sanitizePrivateContent, 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, allowZeroWidthSpaceAfter: true, HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent, profilecardProvider: (_props$mention3 = props.mention) === null || _props$mention3 === void 0 ? void 0 : _props$mention3.profilecardProvider, mentionProvider: props.mentionProvider }, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.mentionsPlugin)], Boolean(props.mentionProvider)).maybeAdd([_emoji.emojiPlugin, _objectSpread({ emojiProvider: props.emojiProvider }, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.emojiPlugin)], Boolean(props.emojiProvider)).maybeAdd([_table.tablesPlugin, { tableOptions: !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables, isTableScalingEnabled: isFullPage || isComment, allowContextualMenu: true, fullWidthEnabled: appearance === 'full-width', wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width', getEditorFeatureFlags: getEditorFeatureFlags, isCommentEditor: isComment, isChromelessEditor: isChromeless, allowFixedColumnWidthOption: (0, _platformFeatureFlags.fg)('platform_editor_table_fixed_column_width_prop') ? props.allowTables && typeof props.allowTables !== 'boolean' && props.allowTables.allowFixedColumnWidthOption : false }], Boolean(props.allowTables)).maybeAdd([_tasksAndDecisions.tasksAndDecisionsPlugin, _objectSpread({ allowNestedTasks: props.allowNestedTasks, consumeTabs: isFullPage, useLongPressSelection: false, taskDecisionProvider: props.taskDecisionProvider }, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.tasksAndDecisionsPlugin)], Boolean(props.allowTasksAndDecisions || props.taskDecisionProvider)).maybeAdd([_feedbackDialog.feedbackDialogPlugin, _objectSpread({ coreVersion: _versionWrapper.version }, props.feedbackInfo)], Boolean(props.feedbackInfo)).maybeAdd([_helpDialog.helpDialogPlugin, !!props.legacyImageUploadProvider], Boolean(props.allowHelpDialog)).maybeAdd([_saveOnEnter.saveOnEnterPlugin, props.onSave], Boolean(props.saveOnEnter && props.onSave)).maybeAdd(_imageUpload.imageUploadPlugin, Boolean(props.legacyImageUploadProvider)).maybeAdd( // duplicate plugin exists because first one if media is enabled // second one when “media is disabled, and legacyMediaProvider is enabled // @ts-expect-error [_media.mediaPlugin, { allowMediaSingle: { disableLayout: true }, allowMediaGroup: false, isCopyPasteEnabled: true }], Boolean(props.legacyImageUploadProvider && !props.media)).maybeAdd([_collabEdit.collabEditPlugin, _objectSpread(_objectSpread({}, props.collabEdit), {}, { sanitizePrivateContent: props.sanitizePrivateContent, 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 : (0, _utils.shouldForceTracking)() })], Boolean(props.collabEdit || props.collabEditProvider)).maybeAdd([_maxContentSize.maxContentSizePlugin, props.maxContentSize], Boolean(props.maxContentSize)).maybeAdd([_panel.panelPlugin, { useLongPressSelection: false, allowCustomPanel: (0, _typeof2.default)(props.allowPanel) === 'object' ? props.allowPanel.allowCustomPanel : false, allowCustomPanelEdit: (0, _typeof2.default)(props.allowPanel) === 'object' ? props.allowPanel.allowCustomPanelEdit : false }], Boolean(props.allowPanel)).maybeAdd(_contextPanel.contextPanelPlugin, Boolean(isFullPage)).maybeAdd([_extension.extensionPlugin, _objectSpread({ breakoutEnabled: appearance === 'full-page' && ((0, _typeof2.default)(props.allowExtension) === 'object' ? props.allowExtension.allowBreakout : true) !== false, extensionHandlers: props.extensionHandlers, useLongPressSelection: false, appearance: appearance }, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.extensionPlugin)], Boolean(props.allowExtension)).maybeAdd( // we are ignoring a duplicate plugin error here // this error exists because we have two annotation plugins being added // one with annotationProviders and one with allowConfluenceInlineComment // long term this and media should be consolidated into adding both only once // @ts-expect-error [_annotation.annotationPlugin, undefined], Boolean(!props.annotationProviders && props.allowConfluenceInlineComment)).maybeAdd([_date.datePlugin, { weekStartDay: (0, _typeof2.default)(props.allowDate) === 'object' ? props.allowDate.weekStartDay : undefined }], Boolean(props.allowDate)).maybeAdd([_placeholderText.placeholderTextPlugin, // @ts-expect-error 2322: Type 'false | PlaceholderTextOptions | undefined' props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {}], Boolean(props.allowTemplatePlaceholders)).maybeAdd([_layout.layoutPlugin, _objectSpread(_objectSpread({}, (0, _typeof2.default)(props.allowLayouts) === 'object' ? props.allowLayouts : {}), {}, { useLongPressSelection: false, UNSAFE_allowSingleColumnLayout: (0, _typeof2.default)(props.allowLayouts) === 'object' ? props.allowLayouts.UNSAFE_allowSingleColumnLayout : undefined, editorAppearance: appearance })], Boolean(props.allowLayouts)).maybeAdd([_card.cardPlugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks), {}, { fullWidthMode: appearance === 'full-width', linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker, lpLinkPicker: (_featureFlags$lpLinkP2 = featureFlags.lpLinkPicker) !== null && _featureFlags$lpLinkP2 !== void 0 ? _featureFlags$lpLinkP2 : false, editorAppearance: appearance, // @ts-ignore Temporary solution to check for Live Page editor. __livePage: props.__livePage })], Boolean(((_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.smartLinks) || props.smartLinks || props.UNSAFE_cards)).maybeAdd([_customAutoformat.customAutoformatPlugin, { autoformattingProvider: props.autoformattingProvider }], Boolean(props.autoformattingProvider)).maybeAdd([_status.statusPlugin, { menuDisabled: statusMenuDisabled, allowZeroWidthSpaceAfter: true }], Boolean(props.allowStatus)).maybeAdd([_syncedBlock.syncedBlockPlugin, props.syncBlock], Boolean(props.syncBlock) && (0, _experiments.editorExperiment)('platform_synced_block', true)).maybeAdd(_indentation.indentationPlugin, Boolean(props.allowIndentation)).maybeAdd(_scrollIntoView.scrollIntoViewPlugin, Boolean(props.autoScrollIntoView !== false)).add([_toolbarListsIndentation.toolbarListsIndentationPlugin, { showIndentationButtons: !!props.showIndentationButtons, allowHeadingAndParagraphIndentation: !!props.allowIndentation }]).add([_insertBlock.insertBlockPlugin, _objectSpread({ allowTables: !!props.allowTables, allowExpand: isExpandInsertionEnabled(props), insertMenuItems: props.insertMenuItems, horizontalRuleEnabled: props.allowRule, tableSelectorSupported: (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.tableSelector) && isFullPage, nativeStatusSupported: !statusMenuDisabled, showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false, appearance: appearance }, initialPluginConfiguration === null || initialPluginConfiguration === void 0 ? void 0 : initialPluginConfiguration.insertBlockPlugin)]).maybeAdd([_beforePrimaryToolbar.beforePrimaryToolbarPlugin, { beforePrimaryToolbarComponents: // @ts-expect-error 2339: Property 'before' does not exist on type 'PrimaryToolbarComponents'. (_props$primaryToolbar = props.primaryToolbarComponents) === null || _props$primaryToolbar === void 0 ? void 0 : _props$primaryToolbar.before }], Boolean(hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar)).add([_avatarGroup.avatarGroupPlugin, { // Avatars are moved to Confluence codebase for Edit in Context // When Edit in Context is enabled primaryToolbarComponents is undefined // For more details please check // https://hello.atlassian.net/wiki/spaces/PCG/pages/2851572180/Editor+toolbar+for+live+pages+and+edit+in+context+projects collabEdit: props.collabEdit, takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents), showAvatarGroup: featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar }]).maybeAdd([_findReplace.findReplacePlugin, { takeFullWidth: !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents), twoLineEditorToolbar: !!props.primaryToolbarComponents && !!featureFlags.twoLineEditorToolbar }], Boolean(props.allowFindReplace)).maybeAdd(_border.borderPlugin, Boolean(props.allowBorderMark)).maybeAdd(_fragment.fragmentPlugin, Boolean(props.allowFragmentMark)).add(_pasteOptionsToolbar.pasteOptionsToolbarPlugin).maybeAdd([_codeBidiWarning.codeBidiWarningPlugin, { appearance: appearance }], !(0, _expValEquals.expValEquals)('platform_editor_remove_bidi_char_warning', 'isEnabled', true)); return finalPreset; } function isExpandInsertionEnabled(_ref2) { var allowExpand = _ref2.allowExpand; if (allowExpand === true && (0, _expValEquals.expValEquals)('platform_editor_expand_paste_in_comment_editor', 'isEnabled', true)) { return true; } if (allowExpand && (0, _typeof2.default)(allowExpand) === 'object') { return !!allowExpand.allowInsertion; } return false; }