mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 02:47:52 +01:00
Firefox: fix copy from edit textarea
This commit is contained in:
parent
027d710716
commit
80f91d129e
@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() {
|
|||||||
// STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied.
|
// 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 <q> to <span> before calling toString().
|
// To work around this, take the selection and transform <q> to <span> before calling toString().
|
||||||
document.addEventListener('copy', function (event) {
|
document.addEventListener('copy', function (event) {
|
||||||
|
if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (!selection.anchorNode?.parentElement.closest('.mes_text')) {
|
if (!selection.anchorNode?.parentElement.closest('.mes_text')) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user