Fix copy buttons on the debug window

This commit is contained in:
Kazuhito Yokoi 2022-01-07 09:27:01 +09:00
parent aaa2b4c3db
commit b00282590d
1 changed files with 2 additions and 3 deletions

View File

@ -940,6 +940,7 @@ RED.clipboard = (function() {
if (truncated) {
msg += "_truncated";
}
var clipboardHidden = $('<textarea type="text" id="red-ui-clipboard-hidden" tabIndex="-1">').appendTo(document.body);
$("#red-ui-clipboard-hidden").val(value).focus().select();
var result = document.execCommand("copy");
if (result && element) {
@ -954,7 +955,7 @@ RED.clipboard = (function() {
},1000);
popover.open();
}
$("#red-ui-clipboard-hidden").val("");
clipboardHidden.remove();
if (currentFocus) {
$(currentFocus).focus();
}
@ -1236,8 +1237,6 @@ RED.clipboard = (function() {
init: function() {
setupDialogs();
$('<textarea type="text" id="red-ui-clipboard-hidden" tabIndex="-1">').appendTo("#red-ui-editor");
RED.actions.add("core:show-export-dialog",showExportNodes);
RED.actions.add("core:show-import-dialog",showImportNodes);