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() {
|
function copy() {
|
||||||
navigator.permissions.query({name: "clipboard-write"}).then((result) => {
|
document.execCommand("copy")
|
||||||
if (result.state === "granted" || result.state === "prompt") {
|
|
||||||
navigator.clipboard.writeText(getSelectionText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function push_from_clipboard(el = document.activeElement) {
|
function paste() {
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd];
|
document.execCommand("paste")
|
||||||
navigator.clipboard.readText().then(
|
}
|
||||||
(clipText) => el.setRangeText(clipText, start, end, 'select'));
|
|
||||||
|
|
||||||
|
function cut() {
|
||||||
|
document.execCommand("cut")
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectionText() {
|
function getSelectionText() {
|
||||||
|
Reference in New Issue
Block a user