diff --git a/patches/quill+1.3.7.patch b/patches/quill+1.3.7.patch index eca2ac692..0652d68f1 100644 --- a/patches/quill+1.3.7.patch +++ b/patches/quill+1.3.7.patch @@ -1,14 +1,16 @@ diff --git a/node_modules/quill/dist/quill.js b/node_modules/quill/dist/quill.js -index 811b3d0..c8c4892 100644 +index 811b3d0..313f301 100644 --- a/node_modules/quill/dist/quill.js +++ b/node_modules/quill/dist/quill.js -@@ -8917,9 +8917,9 @@ var Clipboard = function (_Module) { +@@ -8916,10 +8916,10 @@ var Clipboard = function (_Module) { + var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options)); - _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this)); +- _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this)); - _this.container = _this.quill.addContainer('ql-clipboard'); - _this.container.setAttribute('contenteditable', true); - _this.container.setAttribute('tabindex', -1); ++ // _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this)); + // _this.container = _this.quill.addContainer('ql-clipboard'); + // _this.container.setAttribute('contenteditable', true); + // _this.container.setAttribute('tabindex', -1); diff --git a/ts/quill/signal-clipboard/index.ts b/ts/quill/signal-clipboard/index.ts index 766ce100a..43e15df6a 100644 --- a/ts/quill/signal-clipboard/index.ts +++ b/ts/quill/signal-clipboard/index.ts @@ -34,9 +34,6 @@ export class SignalClipboard { } onCapturePaste(event: ClipboardEvent): void { - event.preventDefault(); - event.stopPropagation(); - if (event.clipboardData == null) { return; } @@ -53,6 +50,13 @@ export class SignalClipboard { const text = event.clipboardData.getData('text/plain'); const html = event.clipboardData.getData('text/html'); + if (!text && !html) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + const clipboardDelta = html ? clipboard.convert(html) : clipboard.convert(replaceAngleBrackets(text));