Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaroldi committed Dec 6, 2024
1 parent 304a15b commit 72dfb20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { coreApiMap } from '../../coreApi/coreApiMap';
import { createDarkColorHandler } from './DarkColorHandlerImpl';
import { createDOMCreator, createTrustedHTMLHandler } from '../../utils/domCreator';
import { createDOMCreator, createTrustedHTMLHandler, isDOMCreator } from '../../utils/domCreator';
import { createDOMHelper } from './DOMHelperImpl';
import { createDomToModelSettings, createModelToDomSettings } from './createEditorDefaultSettings';
import { createEditorCorePlugins } from '../../corePlugin/createEditorCorePlugins';
Expand All @@ -20,7 +20,6 @@ import type {
export function createEditorCore(contentDiv: HTMLDivElement, options: EditorOptions): EditorCore {
const corePlugins = createEditorCorePlugins(options, contentDiv);
const domCreator = createDOMCreator(options.trustedHTMLHandler);
const trustedHTMLHandler = createTrustedHTMLHandler(domCreator);

return {
physicalRoot: contentDiv,
Expand All @@ -46,7 +45,10 @@ export function createEditorCore(contentDiv: HTMLDivElement, options: EditorOpti
options.knownColors,
options.generateColorKey
),
trustedHTMLHandler: trustedHTMLHandler,
trustedHTMLHandler:
options.trustedHTMLHandler && !isDOMCreator(options.trustedHTMLHandler)
? options.trustedHTMLHandler
: createTrustedHTMLHandler(domCreator),
domCreator: domCreator,
domHelper: createDOMHelper(contentDiv),
...getPluginState(corePlugins),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('createEditorCore', () => {
const mockedPlugin1 = 'P1' as any;
const mockedPlugin2 = 'P2' as any;
const mockedGetDarkColor = 'DARK' as any;
const mockedTrustHtmlHandler = 'TRUSTED' as any;
const mockedTrustHtmlHandler = 'OPTIONS TRUSTED' as any;
const mockedDisposeErrorHandler = 'DISPOSE' as any;
const mockedGenerateColorKey = 'KEY' as any;
const mockedKnownColors = 'COLORS' as any;
Expand Down

0 comments on commit 72dfb20

Please sign in to comment.