From c98a8501ad639648c9e2db922926ffc9dca86449 Mon Sep 17 00:00:00 2001 From: "SOUTHAMERICA\\bvalverde" Date: Tue, 26 Nov 2024 17:11:29 -0600 Subject: [PATCH] Remove createDomToModelContextForSanitizing function and related imports --- .../createDomToModelContextForSanitizing.1.ts | 65 ------------------- .../lib/command/paste/mergePasteContent.ts | 2 +- 2 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 packages/roosterjs-content-model-core/lib/command/createModelFromHtml/createDomToModelContextForSanitizing.1.ts diff --git a/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/createDomToModelContextForSanitizing.1.ts b/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/createDomToModelContextForSanitizing.1.ts deleted file mode 100644 index 3ec4f7a1acd..00000000000 --- a/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/createDomToModelContextForSanitizing.1.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { containerSizeFormatParser } from 'roosterjs-content-model-core/lib/override/containerSizeFormatParser'; -import { createDomToModelContext } from 'roosterjs-content-model-dom/lib'; -import { createPasteEntityProcessor } from 'roosterjs-content-model-core/lib/override/pasteEntityProcessor'; -import { createPasteGeneralProcessor } from 'roosterjs-content-model-core/lib/override/pasteGeneralProcessor'; -import { DefaultSanitizingOption } from './createDomToModelContextForSanitizing'; -import { getRootComputedStyleForContext } from 'roosterjs-content-model-core/lib/coreApi/createEditorContext/getRootComputedStyleForContext'; -import { pasteBlockEntityParser } from 'roosterjs-content-model-core/lib/override/pasteCopyBlockEntityParser'; -import { pasteDisplayFormatParser } from 'roosterjs-content-model-core/lib/override/pasteDisplayFormatParser'; -import { pasteTextProcessor } from 'roosterjs-content-model-core/lib/override/pasteTextProcessor'; -import type { - ContentModelSegmentFormat, - DomToModelOption, - DomToModelOptionForSanitizing, - DomToModelContext, -} from 'roosterjs-content-model-types/lib'; - -/** - * @internal - */ - -export function createDomToModelContextForSanitizing( - document: Document, - defaultFormat?: ContentModelSegmentFormat, - defaultOption?: DomToModelOption, - additionalSanitizingOption?: Partial -): DomToModelContext { - const sanitizingOption: DomToModelOptionForSanitizing = { - ...DefaultSanitizingOption, - ...additionalSanitizingOption, - }; - - return createDomToModelContext( - { - defaultFormat, - ...getRootComputedStyleForContext(document), - experimentalFeatures: [], - }, - defaultOption, - { - processorOverride: { - '#text': pasteTextProcessor, - entity: createPasteEntityProcessor(sanitizingOption), - '*': createPasteGeneralProcessor(sanitizingOption), - }, - formatParserOverride: { - display: pasteDisplayFormatParser, - whiteSpace: (format, element, context, defaultStyle) => { - if (element.style.whiteSpace != 'pre') { - context.defaultFormatParsers.whiteSpace?.( - format, - element, - context, - defaultStyle - ); - } - }, - }, - additionalFormatParsers: { - container: [containerSizeFormatParser], - entity: [pasteBlockEntityParser], - }, - }, - sanitizingOption - ); -} diff --git a/packages/roosterjs-content-model-core/lib/command/paste/mergePasteContent.ts b/packages/roosterjs-content-model-core/lib/command/paste/mergePasteContent.ts index 5ffc278d8f7..fb0e61e966a 100644 --- a/packages/roosterjs-content-model-core/lib/command/paste/mergePasteContent.ts +++ b/packages/roosterjs-content-model-core/lib/command/paste/mergePasteContent.ts @@ -1,4 +1,4 @@ -import { createDomToModelContextForSanitizing } from '../createModelFromHtml/createDomToModelContextForSanitizing.1'; +import { createDomToModelContextForSanitizing } from '../createModelFromHtml/createDomToModelContextForSanitizing'; import { ChangeSource, EmptySegmentFormat,