From e6c029f7f2e2a8d7c45c13040a0a3ce3ad5b90be Mon Sep 17 00:00:00 2001 From: ropotv Date: Tue, 10 Sep 2024 14:23:49 +0300 Subject: [PATCH] createTrustedHtml for clipboard --- packages/quill/src/modules/clipboard.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/quill/src/modules/clipboard.ts b/packages/quill/src/modules/clipboard.ts index e4c3f755b5..8a0ce02667 100644 --- a/packages/quill/src/modules/clipboard.ts +++ b/packages/quill/src/modules/clipboard.ts @@ -23,6 +23,7 @@ import { FontStyle } from '../formats/font.js'; import { SizeStyle } from '../formats/size.js'; import { deleteRange } from './keyboard.js'; import normalizeExternalHTML from './normalizeExternalHTML/index.js'; +import createTrustedHtml from "../core/utils/createTrustedHtml"; const debug = logger('quill:clipboard'); @@ -125,7 +126,10 @@ class Clipboard extends Module { } protected convertHTML(html: string) { - const doc = new DOMParser().parseFromString(html, 'text/html'); + const doc = new DOMParser().parseFromString( + createTrustedHtml(html), + 'text/html', + ); this.normalizeHTML(doc); const container = doc.body; const nodeMatches = new WeakMap();