1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

@ -940,6 +940,7 @@ RED.clipboard = (function() {
if (truncated) { if (truncated) {
msg += "_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(); $("#red-ui-clipboard-hidden").val(value).focus().select();
var result = document.execCommand("copy"); var result = document.execCommand("copy");
if (result && element) { if (result && element) {
@ -954,7 +955,7 @@ RED.clipboard = (function() {
},1000); },1000);
popover.open(); popover.open();
} }
$("#red-ui-clipboard-hidden").val(""); clipboardHidden.remove();
if (currentFocus) { if (currentFocus) {
$(currentFocus).focus(); $(currentFocus).focus();
} }
@ -1236,8 +1237,6 @@ RED.clipboard = (function() {
init: function() { init: function() {
setupDialogs(); 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-export-dialog",showExportNodes);
RED.actions.add("core:show-import-dialog",showImportNodes); RED.actions.add("core:show-import-dialog",showImportNodes);