Make apiClipboardGet use plaintext

Also clear the value before returning
This commit is contained in:
toasted-nutbread 2019-12-12 21:01:49 -05:00
parent bf93d9f5f9
commit 11b94d5a82
2 changed files with 5 additions and 3 deletions

View File

@ -12,7 +12,7 @@
<link rel="icon" type="image/png" href="/mixed/img/icon128.png" sizes="128x128">
</head>
<body>
<div id="clipboard-paste-target" contenteditable="true"></div>
<textarea id="clipboard-paste-target" contenteditable="true"></textarea>
<script src="/mixed/lib/handlebars.min.js"></script>
<script src="/mixed/lib/jszip.min.js"></script>

View File

@ -479,10 +479,12 @@ class Backend {
async _onApiClipboardGet() {
const clipboardPasteTarget = this.clipboardPasteTarget;
clipboardPasteTarget.innerText = '';
clipboardPasteTarget.value = '';
clipboardPasteTarget.focus();
document.execCommand('paste');
return clipboardPasteTarget.innerText;
const result = clipboardPasteTarget.value;
clipboardPasteTarget.value = '';
return result;
}
// Command handlers