| 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; |