| 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 | const selection = window.getSelection(); | 9 | const selection = window.getSelection(); |
| 10 | if (selection.anchorNode.nodeName !== '#text' || selection.focusNode.nodeName !== '#text' || !selection.anchorNode?.parentElement.closest('.mes_text')) { | 10 | if (!selection.anchorNode?.parentElement.closest('.mes_text')) { |
| 11 | // Complex selection, skip. | | |
| 12 | return; | 11 | return; |
| 13 | } | 12 | } |
| 14 | | 13 | |