mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Added copy/cut/paste functions for pop-up menu
This commit is contained in:
@@ -2321,19 +2321,16 @@ function retry_from_here() {
|
||||
}
|
||||
}
|
||||
|
||||
function push_to_clipboard() {
|
||||
navigator.permissions.query({name: "clipboard-write"}).then((result) => {
|
||||
if (result.state === "granted" || result.state === "prompt") {
|
||||
navigator.clipboard.writeText(getSelectionText());
|
||||
}
|
||||
});
|
||||
function copy() {
|
||||
document.execCommand("copy")
|
||||
}
|
||||
|
||||
function push_from_clipboard(el = document.activeElement) {
|
||||
const [start, end] = [el.selectionStart, el.selectionEnd];
|
||||
navigator.clipboard.readText().then(
|
||||
(clipText) => el.setRangeText(clipText, start, end, 'select'));
|
||||
|
||||
function paste() {
|
||||
document.execCommand("paste")
|
||||
}
|
||||
|
||||
function cut() {
|
||||
document.execCommand("cut")
|
||||
}
|
||||
|
||||
function getSelectionText() {
|
||||
|
Reference in New Issue
Block a user