Skip to content

Commit

Permalink
createTrustedHtml for clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
ropotvs committed Sep 10, 2024
1 parent 4091322 commit e6c029f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/quill/src/modules/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -125,7 +126,10 @@ class Clipboard extends Module<ClipboardOptions> {
}

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();
Expand Down

0 comments on commit e6c029f

Please sign in to comment.