mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac: copy behaviour
This commit is contained in:
parent
fe54fb61aa
commit
7bae9053ac
1 changed files with 13 additions and 0 deletions
|
|
@ -1030,6 +1030,19 @@
|
||||||
// For all other cases, let ProseMirror perform its default paste behavior.
|
// For all other cases, let ProseMirror perform its default paste behavior.
|
||||||
view.dispatch(view.state.tr.scrollIntoView());
|
view.dispatch(view.state.tr.scrollIntoView());
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
copy: (view, event: ClipboardEvent) => {
|
||||||
|
if (!event.clipboardData) return false;
|
||||||
|
if (richText) return false; // Let ProseMirror handle normal copy in rich text mode
|
||||||
|
|
||||||
|
const plain = editor.getText();
|
||||||
|
const html = editor.getHTML();
|
||||||
|
|
||||||
|
event.clipboardData.setData('text/plain', plain.replaceAll('\n\n', '\n'));
|
||||||
|
event.clipboardData.setData('text/html', html);
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue