From b23f6f8bc9ee617a2de5006c7c73cf5d984f1c78 Mon Sep 17 00:00:00 2001 From: Conlan Craft Date: Fri, 17 Jan 2025 18:27:01 -0600 Subject: [PATCH] Decide whether or not Quill will handle the copy event THEN preventDefault. --- packages/quill/src/modules/clipboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/quill/src/modules/clipboard.ts b/packages/quill/src/modules/clipboard.ts index 78ea67083..1ef9e960a 100644 --- a/packages/quill/src/modules/clipboard.ts +++ b/packages/quill/src/modules/clipboard.ts @@ -170,9 +170,9 @@ class Clipboard extends Module { onCaptureCopy(e: ClipboardEvent, isCut = false) { if (e.defaultPrevented) return; - e.preventDefault(); const [range] = this.quill.selection.getRange(); if (range == null) return; + e.preventDefault(); const { html, text } = this.onCopy(range, isCut); e.clipboardData?.setData('text/plain', text); e.clipboardData?.setData('text/html', html);