diff --git a/demo/scripts/controls/getToggleablePlugins.ts b/demo/scripts/controls/getToggleablePlugins.ts index 0f0b9157812..501dc6d1c28 100644 --- a/demo/scripts/controls/getToggleablePlugins.ts +++ b/demo/scripts/controls/getToggleablePlugins.ts @@ -2,7 +2,7 @@ import BuildInPluginState, { BuildInPluginList, UrlPlaceholder } from './BuildIn import { Announce } from 'roosterjs-editor-plugins/lib/Announce'; import { AutoFormat } from 'roosterjs-editor-plugins/lib/AutoFormat'; import { ContentEdit } from 'roosterjs-editor-plugins/lib/ContentEdit'; -import { ContentModelPastePlugin } from 'roosterjs-content-model-editor'; +import { ContentModelPastePlugin } from 'roosterjs-content-model-plugins'; import { CustomReplace as CustomReplacePlugin } from 'roosterjs-editor-plugins/lib/CustomReplace'; import { CutPasteListChain } from 'roosterjs-editor-plugins/lib/CutPasteListChain'; import { EditorPlugin, KnownAnnounceStrings } from 'roosterjs-editor-types'; diff --git a/demo/scripts/tsconfig.json b/demo/scripts/tsconfig.json index f7754dfecc3..c964dda11ff 100644 --- a/demo/scripts/tsconfig.json +++ b/demo/scripts/tsconfig.json @@ -43,11 +43,11 @@ "roosterjs-content-model-editor/lib/*": [ "packages-content-model/roosterjs-content-model-editor/lib/*" ], - "roosterjs-content-model-adapter": [ - "packages-content-model/roosterjs-content-model-adapter/lib/index" + "roosterjs-content-model-plugins": [ + "packages-content-model/roosterjs-content-model-plugins/lib/index" ], - "roosterjs-content-model-adapter/lib/*": [ - "packages-content-model/roosterjs-content-model-adapter/lib/*" + "roosterjs-content-model-plugins/lib/*": [ + "packages-content-model/roosterjs-content-model-plugins/lib/*" ], "roosterjs-react": ["packages-ui/roosterjs-react/lib/index"], "roosterjs-react/lib/*": ["packages-ui/roosterjs-react/lib/*"] diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/coreApi/createContentModel.ts b/packages-content-model/roosterjs-content-model-editor/lib/editor/coreApi/createContentModel.ts index 071648a0a20..4210d373172 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/coreApi/createContentModel.ts +++ b/packages-content-model/roosterjs-content-model-editor/lib/editor/coreApi/createContentModel.ts @@ -1,4 +1,4 @@ -import { cloneModel } from '../../modelApi/common/cloneModel'; +import { cloneModel } from '../../publicApi/model/cloneModel'; import type { DOMSelection, DomToModelOption } from 'roosterjs-content-model-types'; import { createDomToModelContext, diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/corePlugins/ContentModelCopyPastePlugin.ts b/packages-content-model/roosterjs-content-model-editor/lib/editor/corePlugins/ContentModelCopyPastePlugin.ts index fbf80729f0e..c6212a3361f 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/corePlugins/ContentModelCopyPastePlugin.ts +++ b/packages-content-model/roosterjs-content-model-editor/lib/editor/corePlugins/ContentModelCopyPastePlugin.ts @@ -1,7 +1,7 @@ import paste from '../../publicApi/utils/paste'; import { addRangeToSelection } from '../../domUtils/addRangeToSelection'; import { ChangeSource } from '../../publicTypes/event/ContentModelContentChangedEvent'; -import { cloneModel } from '../../modelApi/common/cloneModel'; +import { cloneModel } from '../../publicApi/model/cloneModel'; import { ColorTransformDirection, PluginEventType } from 'roosterjs-editor-types'; import { deleteSelection } from '../../modelApi/edit/deleteSelection'; import { extractClipboardItems } from 'roosterjs-editor-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/lib/index.ts b/packages-content-model/roosterjs-content-model-editor/lib/index.ts index 3b74a3a7df5..9f55960e261 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/index.ts +++ b/packages-content-model/roosterjs-content-model-editor/lib/index.ts @@ -106,10 +106,10 @@ export { default as setParagraphMargin } from './publicApi/block/setParagraphMar export { default as toggleCode } from './publicApi/segment/toggleCode'; export { default as paste } from './publicApi/utils/paste'; export { default as insertEntity } from './publicApi/entity/insertEntity'; +export { CachedElementHandler, CloneModelOptions, cloneModel } from './publicApi/model/cloneModel'; export { default as ContentModelEditor } from './editor/ContentModelEditor'; export { default as isContentModelEditor } from './editor/isContentModelEditor'; -export { default as ContentModelPastePlugin } from './editor/plugins/PastePlugin/ContentModelPastePlugin'; export { default as ContentModelFormatPlugin } from './editor/corePlugins/ContentModelFormatPlugin'; export { default as ContentModelEditPlugin } from './editor/corePlugins/ContentModelEditPlugin'; diff --git a/packages-content-model/roosterjs-content-model-editor/lib/modelApi/common/cloneModel.ts b/packages-content-model/roosterjs-content-model-editor/lib/publicApi/model/cloneModel.ts similarity index 95% rename from packages-content-model/roosterjs-content-model-editor/lib/modelApi/common/cloneModel.ts rename to packages-content-model/roosterjs-content-model-editor/lib/publicApi/model/cloneModel.ts index a92d5e1fe58..7488c0e6bb3 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/modelApi/common/cloneModel.ts +++ b/packages-content-model/roosterjs-content-model-editor/lib/publicApi/model/cloneModel.ts @@ -28,7 +28,12 @@ import type { } from 'roosterjs-content-model-types'; /** - * @internal + * Function type used for cloneModel API to specify how to handle cached element when clone a model + * @param node The cached node + * @param type Type of the node, it can be + * - general: DOM element of ContentModelGeneralSegment or ContentModelGeneralBlock + * - entity: Wrapper element in ContentModelEntity + * - cache: Cached node in other model element that supports cache */ export type CachedElementHandler = ( node: HTMLElement, @@ -36,7 +41,7 @@ export type CachedElementHandler = ( ) => HTMLElement | undefined; /** - * @internal + * * Options for cloneModel API */ export interface CloneModelOptions { @@ -51,7 +56,9 @@ export interface CloneModelOptions { } /** - * @internal + * Clone a content model + * @param model The content model to clone + * @param options @optional Options to specify customize the clone behavior */ export function cloneModel( model: ContentModelDocument, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/coreApi/createContentModelTest.ts b/packages-content-model/roosterjs-content-model-editor/test/editor/coreApi/createContentModelTest.ts index ca87e4d8305..8fc09a36183 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/coreApi/createContentModelTest.ts +++ b/packages-content-model/roosterjs-content-model-editor/test/editor/coreApi/createContentModelTest.ts @@ -1,4 +1,4 @@ -import * as cloneModel from '../../../lib/modelApi/common/cloneModel'; +import * as cloneModel from '../../../lib/publicApi/model/cloneModel'; import * as createDomToModelContext from 'roosterjs-content-model-dom/lib/domToModel/context/createDomToModelContext'; import * as domToContentModel from 'roosterjs-content-model-dom/lib/domToModel/domToContentModel'; import { ContentModelEditorCore } from '../../../lib/publicTypes/ContentModelEditorCore'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelCopyPastePluginTest.ts b/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelCopyPastePluginTest.ts index 4615bb1d8e6..a56a1f13976 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelCopyPastePluginTest.ts +++ b/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelCopyPastePluginTest.ts @@ -1,5 +1,5 @@ import * as addRangeToSelection from '../../../lib/domUtils/addRangeToSelection'; -import * as cloneModelFile from '../../../lib/modelApi/common/cloneModel'; +import * as cloneModelFile from '../../../lib/publicApi/model/cloneModel'; import * as contentModelToDomFile from 'roosterjs-content-model-dom/lib/modelToDom/contentModelToDom'; import * as deleteSelectionsFile from '../../../lib/modelApi/edit/deleteSelection'; import * as extractClipboardItemsFile from 'roosterjs-editor-dom/lib/clipboard/extractClipboardItems'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/modelApi/common/cloneModelTest.ts b/packages-content-model/roosterjs-content-model-editor/test/publicApi/model/cloneModelTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/modelApi/common/cloneModelTest.ts rename to packages-content-model/roosterjs-content-model-editor/test/publicApi/model/cloneModelTest.ts index 017f0e37797..6ba07467196 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/modelApi/common/cloneModelTest.ts +++ b/packages-content-model/roosterjs-content-model-editor/test/publicApi/model/cloneModelTest.ts @@ -1,4 +1,4 @@ -import { cloneModel } from '../../../lib/modelApi/common/cloneModel'; +import { cloneModel } from '../../../lib/publicApi/model/cloneModel'; import { ContentModelDocument } from 'roosterjs-content-model-types'; import { createEntity } from 'roosterjs-content-model-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/publicApi/utils/pasteTest.ts b/packages-content-model/roosterjs-content-model-editor/test/publicApi/utils/pasteTest.ts index 1b5126950ab..556e68cf733 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/publicApi/utils/pasteTest.ts +++ b/packages-content-model/roosterjs-content-model-editor/test/publicApi/utils/pasteTest.ts @@ -1,19 +1,22 @@ -import * as addParserF from '../../../lib/editor/plugins/PastePlugin/utils/addParser'; +import * as addParserF from '../../../../roosterjs-content-model-plugins/lib/paste/utils/addParser'; import * as domToContentModel from 'roosterjs-content-model-dom/lib/domToModel/domToContentModel'; -import * as ExcelF from '../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; -import * as getPasteSourceF from '../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; +import * as ExcelF from '../../../../roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel'; +import * as getPasteSourceF from '../../../../roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/getPasteSource'; import * as getSelectedSegmentsF from '../../../lib/publicApi/selection/getSelectedSegments'; import * as mergeModelFile from '../../../lib/modelApi/common/mergeModel'; -import * as PPT from '../../../lib/editor/plugins/PastePlugin/PowerPoint/processPastedContentFromPowerPoint'; -import * as setProcessorF from '../../../lib/editor/plugins/PastePlugin/utils/setProcessor'; -import * as WacComponents from '../../../lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents'; -import * as WordDesktopFile from '../../../lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop'; +import * as PPT from '../../../../roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint'; +import * as setProcessorF from '../../../../roosterjs-content-model-plugins/lib/paste/utils/setProcessor'; +import * as WacComponents from '../../../../roosterjs-content-model-plugins/lib/paste/WacComponents/processPastedContentWacComponents'; +import * as WordDesktopFile from '../../../../roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop'; import ContentModelEditor from '../../../lib/editor/ContentModelEditor'; -import ContentModelPastePlugin from '../../../lib/editor/plugins/PastePlugin/ContentModelPastePlugin'; import { ContentModelDocument, DomToModelOption } from 'roosterjs-content-model-types'; +import { ContentModelPastePlugin } from '../../../../roosterjs-content-model-plugins/lib/paste/ContentModelPastePlugin'; import { createContentModelDocument, tableProcessor } from 'roosterjs-content-model-dom'; -import { expectEqual, initEditor } from '../../editor/plugins/paste/e2e/testUtils'; import { IContentModelEditor } from '../../../lib/publicTypes/IContentModelEditor'; +import { + expectEqual, + initEditor, +} from '../../../../roosterjs-content-model-plugins/test/paste/e2e/testUtils'; import { ContentModelFormatter, FormatWithContentModelContext, diff --git a/packages-content-model/roosterjs-content-model-plugins/lib/index.ts b/packages-content-model/roosterjs-content-model-plugins/lib/index.ts new file mode 100644 index 00000000000..d6df2aa5291 --- /dev/null +++ b/packages-content-model/roosterjs-content-model-plugins/lib/index.ts @@ -0,0 +1 @@ +export { ContentModelPastePlugin } from './paste/ContentModelPastePlugin'; diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/ContentModelPastePlugin.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/ContentModelPastePlugin.ts similarity index 95% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/ContentModelPastePlugin.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/ContentModelPastePlugin.ts index 95b51dfa5f2..dde7a01ebfa 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/ContentModelPastePlugin.ts +++ b/packages-content-model/roosterjs-content-model-plugins/lib/paste/ContentModelPastePlugin.ts @@ -10,15 +10,17 @@ import { processPastedContentFromExcel } from './Excel/processPastedContentFromE import { processPastedContentFromPowerPoint } from './PowerPoint/processPastedContentFromPowerPoint'; import { processPastedContentFromWordDesktop } from './WordDesktop/processPastedContentFromWordDesktop'; import { processPastedContentWacComponents } from './WacComponents/processPastedContentWacComponents'; -import type { PasteType } from '../../../publicTypes/parameter/PasteType'; -import type ContentModelBeforePasteEvent from '../../../publicTypes/event/ContentModelBeforePasteEvent'; +import type { + ContentModelBeforePasteEvent, + IContentModelEditor, + PasteType, +} from 'roosterjs-content-model-editor'; import type { BorderFormat, ContentModelBlockFormat, ContentModelTableCellFormat, FormatParser, } from 'roosterjs-content-model-types'; -import type { IContentModelEditor } from '../../../publicTypes/IContentModelEditor'; import type { EditorPlugin, HtmlSanitizerOptions, @@ -43,7 +45,7 @@ const PasteTypeMap: Record = { * 4. Content copied from Power Point * (This class is still under development, and may still be changed in the future with some breaking changes) */ -export default class ContentModelPastePlugin implements EditorPlugin { +export class ContentModelPastePlugin implements EditorPlugin { private editor: IContentModelEditor | null = null; /** diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts similarity index 96% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts index 2bd97574f30..86a645b64c1 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel.ts +++ b/packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts @@ -1,8 +1,8 @@ import addParser from '../utils/addParser'; import { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom'; import { setProcessor } from '../utils/setProcessor'; -import type ContentModelBeforePasteEvent from '../../../../publicTypes/event/ContentModelBeforePasteEvent'; import type { TrustedHTMLHandler } from 'roosterjs-editor-types'; +import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-editor'; const LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i; const LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i; diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/PowerPoint/processPastedContentFromPowerPoint.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/PowerPoint/processPastedContentFromPowerPoint.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WacComponents/processPastedContentWacComponents.ts similarity index 98% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/WacComponents/processPastedContentWacComponents.ts index 24e50482002..6d948f05744 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents.ts +++ b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WacComponents/processPastedContentWacComponents.ts @@ -1,6 +1,6 @@ import addParser from '../utils/addParser'; import { setProcessor } from '../utils/setProcessor'; -import type ContentModelBeforePasteEvent from '../../../../publicTypes/event/ContentModelBeforePasteEvent'; +import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-editor'; import type { ContentModelBlockFormat, ContentModelBlockGroup, diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts similarity index 97% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts index 965e55daf60..8e46d06e05f 100644 --- a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop.ts +++ b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts @@ -5,7 +5,7 @@ import { moveChildNodes } from 'roosterjs-content-model-dom'; import { processWordComments } from './processWordComments'; import { processWordList } from './processWordLists'; import { setProcessor } from '../utils/setProcessor'; -import type ContentModelBeforePasteEvent from '../../../../publicTypes/event/ContentModelBeforePasteEvent'; +import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-editor'; import type { ContentModelBlockFormat, ContentModelListItemFormat, diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processWordComments.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordComments.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processWordComments.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordComments.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processWordLists.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/WordDesktop/processWordLists.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/constants.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/constants.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/constants.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/constants.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/documentContainWacElements.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/documentContainWacElements.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/documentContainWacElements.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/documentContainWacElements.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/getPasteSource.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/getPasteSource.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelDesktopDocument.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelDesktopDocument.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelDesktopDocument.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelDesktopDocument.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelOnlineDocument.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelOnlineDocument.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelOnlineDocument.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isExcelOnlineDocument.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isGoogleSheetDocument.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isGoogleSheetDocument.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isGoogleSheetDocument.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isGoogleSheetDocument.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isPowerPointDesktopDocument.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isPowerPointDesktopDocument.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isWordDesktopDocument.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isWordDesktopDocument.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/isWordDesktopDocument.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/isWordDesktopDocument.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/shouldConvertToSingleImage.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/pasteSourceValidations/shouldConvertToSingleImage.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/addParser.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/addParser.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/addParser.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/addParser.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/deprecatedColorParser.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/deprecatedColorParser.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/deprecatedColorParser.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/deprecatedColorParser.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/getStyles.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/getStyles.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/getStyles.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/getStyles.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/linkParser.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/linkParser.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/linkParser.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/linkParser.ts diff --git a/packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/setProcessor.ts b/packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/setProcessor.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/lib/editor/plugins/PastePlugin/utils/setProcessor.ts rename to packages-content-model/roosterjs-content-model-plugins/lib/paste/utils/setProcessor.ts diff --git a/packages-content-model/roosterjs-content-model-plugins/package.json b/packages-content-model/roosterjs-content-model-plugins/package.json new file mode 100644 index 00000000000..1af019fc5c2 --- /dev/null +++ b/packages-content-model/roosterjs-content-model-plugins/package.json @@ -0,0 +1,15 @@ +{ + "name": "roosterjs-content-model-plugins", + "description": "Content Model for roosterjs (Under development)", + "dependencies": { + "tslib": "^2.3.1", + "roosterjs-editor-types": "", + "roosterjs-editor-dom": "", + "roosterjs-editor-core": "", + "roosterjs-content-model-editor": "", + "roosterjs-content-model-dom": "", + "roosterjs-content-model-types": "" + }, + "version": "0.0.0", + "main": "./lib/index.ts" +} diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelPastePluginTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/ContentModelPastePluginTest.ts similarity index 88% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelPastePluginTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/ContentModelPastePluginTest.ts index cdf8cf512af..3a19bf2d8b6 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/ContentModelPastePluginTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/ContentModelPastePluginTest.ts @@ -1,15 +1,14 @@ -import * as addParser from '../../../lib/editor/plugins/PastePlugin/utils/addParser'; +import * as addParser from '../../lib/paste/utils/addParser'; import * as chainSanitizerCallbackFile from 'roosterjs-editor-dom/lib/htmlSanitizer/chainSanitizerCallback'; -import * as ExcelFile from '../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; -import * as getPasteSource from '../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import * as PowerPointFile from '../../../lib/editor/plugins/PastePlugin/PowerPoint/processPastedContentFromPowerPoint'; -import * as setProcessor from '../../../lib/editor/plugins/PastePlugin/utils/setProcessor'; -import * as WacFile from '../../../lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents'; -import * as WordDesktopFile from '../../../lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop'; -import ContentModelBeforePasteEvent from '../../../lib/publicTypes/event/ContentModelBeforePasteEvent'; -import ContentModelPastePlugin from '../../../lib/editor/plugins/PastePlugin/ContentModelPastePlugin'; -import { IContentModelEditor } from '../../../lib/publicTypes/IContentModelEditor'; -import { PastePropertyNames } from '../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/constants'; +import * as ExcelFile from '../../lib/paste/Excel/processPastedContentFromExcel'; +import * as getPasteSource from '../../lib/paste/pasteSourceValidations/getPasteSource'; +import * as PowerPointFile from '../../lib/paste/PowerPoint/processPastedContentFromPowerPoint'; +import * as setProcessor from '../../lib/paste/utils/setProcessor'; +import * as WacFile from '../../lib/paste/WacComponents/processPastedContentWacComponents'; +import * as WordDesktopFile from '../../lib/paste/WordDesktop/processPastedContentFromWordDesktop'; +import { ContentModelBeforePasteEvent, IContentModelEditor } from 'roosterjs-content-model-editor'; +import { ContentModelPastePlugin } from '../../lib/paste/ContentModelPastePlugin'; +import { PastePropertyNames } from '../../lib/paste/pasteSourceValidations/constants'; import { PasteType, PluginEventType } from 'roosterjs-editor-types'; const trustedHTMLHandler = 'mock'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/deprecatedColorParserTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/deprecatedColorParserTest.ts similarity index 88% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/deprecatedColorParserTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/deprecatedColorParserTest.ts index 23fe6db6960..55e8efa4263 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/deprecatedColorParserTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/deprecatedColorParserTest.ts @@ -1,4 +1,4 @@ -import { deprecatedBorderColorParser } from '../../../../lib/editor/plugins/PastePlugin/utils/deprecatedColorParser'; +import { deprecatedBorderColorParser } from '../../lib/paste/utils/deprecatedColorParser'; const DeprecatedColors: string[] = [ 'activeborder', diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelOnlineTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelOnlineTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelOnlineTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelOnlineTest.ts index 786f8263b4a..9b2700ec494 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelOnlineTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelOnlineTest.ts @@ -1,8 +1,7 @@ -import * as processPastedContentFromExcel from '../../../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; -import paste from '../../../../../lib/publicApi/utils/paste'; +import * as processPastedContentFromExcel from '../../../lib/paste/Excel/processPastedContentFromExcel'; import { ClipboardData } from 'roosterjs-editor-types'; import { expectEqual, initEditor } from './testUtils'; -import { IContentModelEditor } from '../../../../../lib/publicTypes/IContentModelEditor'; +import { IContentModelEditor, paste } from 'roosterjs-content-model-editor'; import { itChromeOnly } from 'roosterjs-editor-dom/test/DomTestHelper'; import { tableProcessor } from 'roosterjs-content-model-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelTest.ts index 3c79c0625bd..c737b5e9012 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromExcelTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelTest.ts @@ -1,9 +1,8 @@ -import * as processPastedContentFromExcel from '../../../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; -import paste from '../../../../../lib/publicApi/utils/paste'; +import * as processPastedContentFromExcel from '../../../lib/paste/Excel/processPastedContentFromExcel'; import { Browser } from 'roosterjs-editor-dom'; import { ClipboardData } from 'roosterjs-editor-types'; import { expectEqual, initEditor } from './testUtils'; -import { IContentModelEditor } from '../../../../../lib/publicTypes/IContentModelEditor'; +import { IContentModelEditor, paste } from 'roosterjs-content-model-editor'; import { itChromeOnly } from 'roosterjs-editor-dom/test/DomTestHelper'; import { tableProcessor } from 'roosterjs-content-model-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWacTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWacTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWacTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWacTest.ts index cc5eddaedb3..36411322f5f 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWacTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWacTest.ts @@ -1,9 +1,8 @@ -import * as processPastedContentWacComponents from '../../../../../lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents'; -import paste from '../../../../../lib/publicApi/utils/paste'; +import * as processPastedContentWacComponents from '../../../lib/paste/WacComponents/processPastedContentWacComponents'; import { ClipboardData } from 'roosterjs-editor-types'; import { DomToModelOption } from 'roosterjs-content-model-types'; import { expectEqual, initEditor } from './testUtils'; -import { IContentModelEditor } from '../../../../../lib/publicTypes/IContentModelEditor'; +import { IContentModelEditor, paste } from 'roosterjs-content-model-editor'; import { tableProcessor } from 'roosterjs-content-model-dom'; const ID = 'CM_Paste_From_WORD_Online_E2E'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWordTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWordTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWordTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWordTest.ts index 7a44986901e..ec029e34767 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteFromWordTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWordTest.ts @@ -1,10 +1,8 @@ -import * as wordFile from '../../../../../lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop'; -import paste from '../../../../../lib/publicApi/utils/paste'; +import * as wordFile from '../../../lib/paste/WordDesktop/processPastedContentFromWordDesktop'; import { ClipboardData } from 'roosterjs-editor-types'; -import { cloneModel } from '../../../../../lib/modelApi/common/cloneModel'; +import { cloneModel, IContentModelEditor, paste } from 'roosterjs-content-model-editor'; import { DomToModelOption } from 'roosterjs-content-model-types'; import { expectEqual, initEditor } from './testUtils'; -import { IContentModelEditor } from '../../../../../lib/publicTypes/IContentModelEditor'; import { itChromeOnly } from 'roosterjs-editor-dom/test/DomTestHelper'; import { tableProcessor } from 'roosterjs-content-model-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteTest.ts similarity index 98% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteTest.ts index 0e2de9639cf..efee14a775f 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/cmPasteTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/cmPasteTest.ts @@ -1,9 +1,8 @@ -import * as wordFile from '../../../../../lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop'; -import paste from '../../../../../lib/publicApi/utils/paste'; +import * as wordFile from '../../../lib/paste/WordDesktop/processPastedContentFromWordDesktop'; import { ClipboardData } from 'roosterjs-editor-types'; import { DomToModelOption } from 'roosterjs-content-model-types'; import { expectEqual, initEditor } from './testUtils'; -import { IContentModelEditor } from '../../../../../lib/publicTypes/IContentModelEditor'; +import { IContentModelEditor, paste } from 'roosterjs-content-model-editor'; import { itChromeOnly } from 'roosterjs-editor-dom/test/DomTestHelper'; import { tableProcessor } from 'roosterjs-content-model-dom'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/testUtils.ts similarity index 70% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/testUtils.ts index a1e3f1d7d77..89b2b719981 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/e2e/testUtils.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/e2e/testUtils.ts @@ -1,13 +1,13 @@ -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 { ContentModelPastePlugin } from '../../../lib/paste/ContentModelPastePlugin'; import { ContentModelEditorOptions, + ContentModelEditor, IContentModelEditor, -} from '../../../../../lib/publicTypes/IContentModelEditor'; + cloneModel, +} from 'roosterjs-content-model-editor'; -export function initEditor(id: string) { +export function initEditor(id: string): IContentModelEditor { let node = document.createElement('div'); node.id = id; document.body.insertBefore(node, document.body.childNodes[0]); @@ -26,7 +26,7 @@ export function initEditor(id: string) { let editor = new ContentModelEditor(node as HTMLDivElement, options); - return editor as IContentModelEditor; + return editor; } export function expectEqual(model1: ContentModelDocument, model2: ContentModelDocument) { diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/linkParserTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/linkParserTest.ts similarity index 98% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/linkParserTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/linkParserTest.ts index f55d8ea8888..a1be1151bf5 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/linkParserTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/linkParserTest.ts @@ -1,6 +1,6 @@ import { ContentModelDocument } from 'roosterjs-content-model-types'; import { createBeforePasteEventMock } from './processPastedContentFromWordDesktopTest'; -import { parseLink } from '../../../../lib/editor/plugins/PastePlugin/utils/linkParser'; +import { parseLink } from '../../lib/paste/utils/linkParser'; import { contentModelToDom, createDomToModelContext, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/documentContainWacElementsTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/documentContainWacElementsTest.ts similarity index 91% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/documentContainWacElementsTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/documentContainWacElementsTest.ts index 8075be62b34..e499ab2dc66 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/documentContainWacElementsTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/documentContainWacElementsTest.ts @@ -1,5 +1,5 @@ -import { documentContainWacElements } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/documentContainWacElements'; -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; +import { documentContainWacElements } from '../../../lib/paste/pasteSourceValidations/documentContainWacElements'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; import { getWacElement } from './pasteTestUtils'; describe('documentContainWacElements |', () => { diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/getPasteSourceTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/getPasteSourceTest.ts similarity index 94% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/getPasteSourceTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/getPasteSourceTest.ts index 67baf9f23f2..d1d82fc682f 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/getPasteSourceTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/getPasteSourceTest.ts @@ -1,6 +1,6 @@ import { BeforePasteEvent, ClipboardData } from 'roosterjs-editor-types'; -import { getPasteSource } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { PastePropertyNames } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/constants'; +import { getPasteSource } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { PastePropertyNames } from '../../../lib/paste/pasteSourceValidations/constants'; import { EXCEL_ATTRIBUTE_VALUE, getWacElement, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts similarity index 83% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts index 8a338712815..ef93fabee8c 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelDesktopDocumentTest.ts @@ -1,6 +1,6 @@ import { EXCEL_ATTRIBUTE_VALUE } from './pasteTestUtils'; -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { isExcelDesktopDocument } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelDesktopDocument'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { isExcelDesktopDocument } from '../../../lib/paste/pasteSourceValidations/isExcelDesktopDocument'; const EXCEL_ONLINE_ATTRIBUTE_VALUE = 'Excel.Sheet'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts similarity index 79% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts index 50bab7a70ad..f44a719c38a 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isExcelOnlineDocumentTest.ts @@ -1,6 +1,6 @@ import { EXCEL_ATTRIBUTE_VALUE } from './pasteTestUtils'; -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { isExcelOnlineDocument } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/isExcelOnlineDocument'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { isExcelOnlineDocument } from '../../../lib/paste/pasteSourceValidations/isExcelOnlineDocument'; const EXCEL_ONLINE_ATTRIBUTE_VALUE = 'Excel.Sheet'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts similarity index 71% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts index 4aec82dae22..16471e31f03 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isGoogleSheetDocumentTest.ts @@ -1,7 +1,7 @@ -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; import { getWacElement } from './pasteTestUtils'; -import { isGoogleSheetDocument } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/isGoogleSheetDocument'; -import { PastePropertyNames } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/constants'; +import { isGoogleSheetDocument } from '../../../lib/paste/pasteSourceValidations/isGoogleSheetDocument'; +import { PastePropertyNames } from '../../../lib/paste/pasteSourceValidations/constants'; describe('isGoogleSheetDocument |', () => { it('Is from Google Sheets', () => { diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts similarity index 68% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts index d9f1180db46..194f1d2a539 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isPowerPointDesktopDocumentTest.ts @@ -1,5 +1,5 @@ -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { isPowerPointDesktopDocument } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/isPowerPointDesktopDocument'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { isPowerPointDesktopDocument } from '../../../lib/paste/pasteSourceValidations/isPowerPointDesktopDocument'; import { POWERPOINT_ATTRIBUTE_VALUE } from './pasteTestUtils'; describe('isPowerPointDesktopDocument |', () => { diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts similarity index 82% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts index e6414c4830b..7fe63ffea12 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/isWordDesktopDocumentTest.ts @@ -1,5 +1,5 @@ -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { isWordDesktopDocument } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/isWordDesktopDocument'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { isWordDesktopDocument } from '../../../lib/paste/pasteSourceValidations/isWordDesktopDocument'; import { WORD_ATTRIBUTE_VALUE } from './pasteTestUtils'; const WORD_PROG_ID = 'Word.Document'; diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/pasteTestUtils.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/pasteTestUtils.ts similarity index 100% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/pasteTestUtils.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/pasteTestUtils.ts diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts similarity index 82% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts index 5efba972efa..df6b78663c3 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/pasteSourceValidations/shouldConvertToSingleImageTest.ts @@ -1,6 +1,6 @@ import { ClipboardData } from 'roosterjs-editor-types'; -import { GetSourceInputParams } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/getPasteSource'; -import { shouldConvertToSingleImage } from '../../../../../lib/editor/plugins/PastePlugin/pasteSourceValidations/shouldConvertToSingleImage'; +import { GetSourceInputParams } from '../../../lib/paste/pasteSourceValidations/getPasteSource'; +import { shouldConvertToSingleImage } from '../../../lib/paste/pasteSourceValidations/shouldConvertToSingleImage'; describe('shouldConvertToSingleImage |', () => { it('Is Single Image', () => { diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromExcelTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromExcelTest.ts similarity index 98% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromExcelTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromExcelTest.ts index 8d73b24ae72..ecd95a2316d 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromExcelTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromExcelTest.ts @@ -1,8 +1,8 @@ -import * as PastePluginFile from '../../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; +import * as PastePluginFile from '../../lib/paste/Excel/processPastedContentFromExcel'; import { Browser } from 'roosterjs-editor-dom'; import { ContentModelDocument } from 'roosterjs-content-model-types'; import { createBeforePasteEventMock } from './processPastedContentFromWordDesktopTest'; -import { processPastedContentFromExcel } from '../../../../lib/editor/plugins/PastePlugin/Excel/processPastedContentFromExcel'; +import { processPastedContentFromExcel } from '../../lib/paste/Excel/processPastedContentFromExcel'; import { contentModelToDom, createDomToModelContext, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromPowerPointTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromPowerPointTest.ts similarity index 96% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromPowerPointTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromPowerPointTest.ts index d945fc8adc5..db4976d67b7 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromPowerPointTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromPowerPointTest.ts @@ -1,6 +1,6 @@ import * as moveChildNodes from 'roosterjs-content-model-dom/lib/domUtils/moveChildNodes'; import { createDefaultHtmlSanitizerOptions } from 'roosterjs-editor-dom'; -import { processPastedContentFromPowerPoint } from '../../../../lib/editor/plugins/PastePlugin/PowerPoint/processPastedContentFromPowerPoint'; +import { processPastedContentFromPowerPoint } from '../../lib/paste/PowerPoint/processPastedContentFromPowerPoint'; import { BeforePasteEvent, ClipboardData, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWacTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWacTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWacTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWacTest.ts index 7f91c7c4c1c..36330c28ba6 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWacTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWacTest.ts @@ -2,11 +2,12 @@ import { Browser } from 'roosterjs-editor-dom'; import { ContentModelDocument } from 'roosterjs-content-model-types'; import { createBeforePasteEventMock } from './processPastedContentFromWordDesktopTest'; import { itChromeOnly } from 'roosterjs-editor-dom/test/DomTestHelper'; -import { processPastedContentWacComponents } from '../../../../lib/editor/plugins/PastePlugin/WacComponents/processPastedContentWacComponents'; +import { processPastedContentWacComponents } from '../../lib/paste/WacComponents/processPastedContentWacComponents'; import { listItemMetadataApplier, listLevelMetadataApplier, -} from '../../../../lib/domUtils/metadata/updateListMetadata'; +} from 'roosterjs-content-model-editor/lib/domUtils/metadata/updateListMetadata'; + import { contentModelToDom, createDomToModelContext, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWordDesktopTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWordDesktopTest.ts similarity index 99% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWordDesktopTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWordDesktopTest.ts index ee44ce2be0b..b04c44d84da 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/processPastedContentFromWordDesktopTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/processPastedContentFromWordDesktopTest.ts @@ -1,12 +1,12 @@ -import ContentModelBeforePasteEvent from '../../../../lib/publicTypes/event/ContentModelBeforePasteEvent'; import { ClipboardData, PluginEventType } from 'roosterjs-editor-types'; +import { ContentModelBeforePasteEvent } from 'roosterjs-content-model-editor'; import { ContentModelDocument } from 'roosterjs-content-model-types'; import { expectHtml } from 'roosterjs-editor-api/test/TestHelper'; -import { processPastedContentFromWordDesktop } from '../../../../lib/editor/plugins/PastePlugin/WordDesktop/processPastedContentFromWordDesktop'; import { listItemMetadataApplier, listLevelMetadataApplier, -} from '../../../../lib/domUtils/metadata/updateListMetadata'; +} from 'roosterjs-content-model-editor/lib/domUtils/metadata/updateListMetadata'; +import { processPastedContentFromWordDesktop } from '../../lib/paste/WordDesktop/processPastedContentFromWordDesktop'; import { contentModelToDom, createDomToModelContext, diff --git a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/utils/getStylesTest.ts b/packages-content-model/roosterjs-content-model-plugins/test/paste/utils/getStylesTest.ts similarity index 92% rename from packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/utils/getStylesTest.ts rename to packages-content-model/roosterjs-content-model-plugins/test/paste/utils/getStylesTest.ts index 8b684b5742c..921655d20a4 100644 --- a/packages-content-model/roosterjs-content-model-editor/test/editor/plugins/paste/utils/getStylesTest.ts +++ b/packages-content-model/roosterjs-content-model-plugins/test/paste/utils/getStylesTest.ts @@ -1,4 +1,4 @@ -import { getStyles } from '../../../../../lib/editor/plugins/PastePlugin/utils/getStyles'; +import { getStyles } from '../../../lib/paste/utils/getStyles'; describe('getStyles', () => { function runTest(style: string, expected: Record) { diff --git a/packages-content-model/roosterjs-content-model/lib/createContentModelEditor.ts b/packages-content-model/roosterjs-content-model/lib/createContentModelEditor.ts index 14d85491728..a29a607d723 100644 --- a/packages-content-model/roosterjs-content-model/lib/createContentModelEditor.ts +++ b/packages-content-model/roosterjs-content-model/lib/createContentModelEditor.ts @@ -1,4 +1,5 @@ -import { ContentModelEditor, ContentModelPastePlugin } from 'roosterjs-content-model-editor'; +import { ContentModelEditor } from 'roosterjs-content-model-editor'; +import { ContentModelPastePlugin } from 'roosterjs-content-model-plugins'; import { getDarkColor } from 'roosterjs-color-utils'; import type { EditorPlugin } from 'roosterjs-editor-types'; import type { diff --git a/packages-content-model/roosterjs-content-model/lib/index.ts b/packages-content-model/roosterjs-content-model/lib/index.ts index 2954c80afd4..85fdf04405e 100644 --- a/packages-content-model/roosterjs-content-model/lib/index.ts +++ b/packages-content-model/roosterjs-content-model/lib/index.ts @@ -2,3 +2,4 @@ export { createContentModelEditor } from './createContentModelEditor'; export * from 'roosterjs-content-model-types'; export * from 'roosterjs-content-model-dom'; export * from 'roosterjs-content-model-editor'; +export * from 'roosterjs-content-model-plugins'; diff --git a/packages-content-model/roosterjs-content-model/package.json b/packages-content-model/roosterjs-content-model/package.json index b1de4e99b1b..afb0cbafea8 100644 --- a/packages-content-model/roosterjs-content-model/package.json +++ b/packages-content-model/roosterjs-content-model/package.json @@ -9,6 +9,7 @@ "roosterjs-content-model-types": "", "roosterjs-content-model-dom": "", "roosterjs-content-model-editor": "", + "roosterjs-content-model-plugins": "", "roosterjs-color-utils": "" }, "version": "0.0.0",