From 80f91d129e0e22c5a48b6171d8dd11dc7e87ab59 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:54:26 +0000 Subject: [PATCH] Firefox: fix copy from edit textarea --- public/scripts/browser-fixes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/scripts/browser-fixes.js b/public/scripts/browser-fixes.js index 96eaa7402..b4b36f552 100644 --- a/public/scripts/browser-fixes.js +++ b/public/scripts/browser-fixes.js @@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() { // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied. // To work around this, take the selection and transform to before calling toString(). document.addEventListener('copy', function (event) { + if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) { + return; + } + const selection = window.getSelection(); if (!selection.anchorNode?.parentElement.closest('.mes_text')) { return;