From 897d4d2fc67ef64daa21cb3b018265f854c8b8bb Mon Sep 17 00:00:00 2001 From: Jiuqing Song Date: Tue, 26 Sep 2023 10:17:56 -0700 Subject: [PATCH] Graduate feature ContentModelPaste (#2102) --- .../editorOptions/ContentModelEditorOptionsPlugin.ts | 5 +---- .../ContentModelExperimentalFeatures.tsx | 1 - .../lib/editor/createContentModelEditorCore.ts | 9 ++------- .../test/editor/plugins/paste/e2e/testUtils.ts | 2 -- .../lib/enum/ExperimentalFeatures.ts | 11 ++++++----- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/demo/scripts/controls/sidePane/editorOptions/ContentModelEditorOptionsPlugin.ts b/demo/scripts/controls/sidePane/editorOptions/ContentModelEditorOptionsPlugin.ts index 45aab3b6e22..e44712d18eb 100644 --- a/demo/scripts/controls/sidePane/editorOptions/ContentModelEditorOptionsPlugin.ts +++ b/demo/scripts/controls/sidePane/editorOptions/ContentModelEditorOptionsPlugin.ts @@ -28,10 +28,7 @@ const initialState: BuildInPluginState = { linkTitle: 'Ctrl+Click to follow the link:' + UrlPlaceholder, watermarkText: 'Type content here ...', forcePreserveRatio: false, - experimentalFeatures: [ - ExperimentalFeatures.ContentModelPaste, - ExperimentalFeatures.ReusableContentModelV2, - ], + experimentalFeatures: [ExperimentalFeatures.ReusableContentModelV2], isRtl: false, tableFeaturesContainerSelector: '#' + 'EditorContainer', }; diff --git a/demo/scripts/controls/sidePane/editorOptions/ContentModelExperimentalFeatures.tsx b/demo/scripts/controls/sidePane/editorOptions/ContentModelExperimentalFeatures.tsx index 6d14fee8947..c8484ddf84a 100644 --- a/demo/scripts/controls/sidePane/editorOptions/ContentModelExperimentalFeatures.tsx +++ b/demo/scripts/controls/sidePane/editorOptions/ContentModelExperimentalFeatures.tsx @@ -14,7 +14,6 @@ const FeatureNames: Partial> = { "Reuse ancestor list elements even if they don't match the types from the list item.", [ExperimentalFeatures.DeleteTableWithBackspace]: 'Delete a table selected with the table selector pressing Backspace key', - [ExperimentalFeatures.ContentModelPaste]: 'Paste with content model', [ExperimentalFeatures.DisableListChain]: 'Disable list chain functionality', [ExperimentalFeatures.ReusableContentModelV2]: 'Reuse existing DOM structure if possible, and update the model when content or selection is changed', diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/createContentModelEditorCore.ts b/packages-content-model/roosterjs-content-model-editor/lib/editor/createContentModelEditorCore.ts index c48ba7bd959..16b203dfbbc 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/createContentModelEditorCore.ts +++ b/packages-content-model/roosterjs-content-model-editor/lib/editor/createContentModelEditorCore.ts @@ -48,13 +48,8 @@ export const createContentModelEditorCore: CoreCreator< ], corePluginOverride: { typeInContainer: new ContentModelTypeInContainerPlugin(), - copyPaste: isFeatureEnabled( - options.experimentalFeatures, - ExperimentalFeatures.ContentModelPaste - ) - ? new ContentModelCopyPastePlugin(pluginState.copyPaste) - : undefined, - ...(options.corePluginOverride || {}), + copyPaste: new ContentModelCopyPastePlugin(pluginState.copyPaste), + ...options.corePluginOverride, }, }; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts b/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts index 8780c350cce..8d235f46915 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts +++ b/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts @@ -2,7 +2,6 @@ import ContentModelEditor from '../../../../../lib/editor/ContentModelEditor'; import ContentModelPastePlugin from '../../../../../lib/editor/plugins/PastePlugin/ContentModelPastePlugin'; import { cloneModel } from '../../../../../lib/modelApi/common/cloneModel'; import { ContentModelDocument } from 'roosterjs-content-model-types'; -import { ExperimentalFeatures } from 'roosterjs-editor-types'; import { ContentModelEditorOptions, IContentModelEditor, @@ -15,7 +14,6 @@ export function initEditor(id: string) { let options: ContentModelEditorOptions = { plugins: [new ContentModelPastePlugin()], - experimentalFeatures: [ExperimentalFeatures.ContentModelPaste], }; let editor = new ContentModelEditor(node as HTMLDivElement, options); diff --git a/packages/roosterjs-editor-types/lib/enum/ExperimentalFeatures.ts b/packages/roosterjs-editor-types/lib/enum/ExperimentalFeatures.ts index 97f87f7eab3..ebb2f61a8a7 100644 --- a/packages/roosterjs-editor-types/lib/enum/ExperimentalFeatures.ts +++ b/packages/roosterjs-editor-types/lib/enum/ExperimentalFeatures.ts @@ -148,6 +148,12 @@ export const enum ExperimentalFeatures { */ InlineEntityReadOnlyDelimiters = 'InlineEntityReadOnlyDelimiters', + /** + * @deprecated This feature is always enabled + * Paste with Content model + */ + ContentModelPaste = 'ContentModelPaste', + //#endregion /** @@ -168,11 +174,6 @@ export const enum ExperimentalFeatures { */ DeleteTableWithBackspace = 'DeleteTableWithBackspace', - /** - * Paste with Content model - */ - ContentModelPaste = 'ContentModelPaste', - /** * Disable list chain functionality */