Firefox: fix copy from edit textarea

80f91d129e0e22c5a48b6171d8dd11dc7e87ab59

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -0Showing whitespace changes
public/scripts/browser-fixes.js+4 -0
@@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() {
6 // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied.6 // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied.
7 // To work around this, take the selection and transform <q> to <span> before calling toString().7 // To work around this, take the selection and transform <q> to <span> before calling toString().
8 document.addEventListener('copy', function (event) {8 document.addEventListener('copy', function (event) {
9 if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) {
10 return;
11 }
12
9 const selection = window.getSelection();13 const selection = window.getSelection();
10 if (!selection.anchorNode?.parentElement.closest('.mes_text')) {14 if (!selection.anchorNode?.parentElement.closest('.mes_text')) {
11 return;15 return;