mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Revert copy-text change and apply alternative fix
Reverts PR #3331 and applies the alternative fix originally proposed in PR #3329
This commit is contained in:
parent
8b1f412255
commit
dbefe6a560
@ -946,8 +946,10 @@ RED.clipboard = (function() {
|
|||||||
if (truncated) {
|
if (truncated) {
|
||||||
msg += "_truncated";
|
msg += "_truncated";
|
||||||
}
|
}
|
||||||
navigator.clipboard.writeText(value).then(function () {
|
var clipboardHidden = $('<textarea type="text" id="red-ui-clipboard-hidden" tabIndex="-1">').appendTo(document.body);
|
||||||
if (element) {
|
clipboardHidden.val(value).focus().select();
|
||||||
|
var result = document.execCommand("copy");
|
||||||
|
if (result && element) {
|
||||||
var popover = RED.popover.create({
|
var popover = RED.popover.create({
|
||||||
target: element,
|
target: element,
|
||||||
direction: 'left',
|
direction: 'left',
|
||||||
@ -959,10 +961,11 @@ RED.clipboard = (function() {
|
|||||||
},1000);
|
},1000);
|
||||||
popover.open();
|
popover.open();
|
||||||
}
|
}
|
||||||
|
clipboardHidden.remove();
|
||||||
if (currentFocus) {
|
if (currentFocus) {
|
||||||
$(currentFocus).focus();
|
$(currentFocus).focus();
|
||||||
}
|
}
|
||||||
}).catch(err => { console.error("Failed to copy:",err) });
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function importNodes(nodesStr,addFlow) {
|
function importNodes(nodesStr,addFlow) {
|
||||||
|
@ -356,6 +356,11 @@ button.red-ui-button-small
|
|||||||
background: $secondary-background;
|
background: $secondary-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#red-ui-clipboard-hidden {
|
||||||
|
position: absolute;
|
||||||
|
top: -3000px;
|
||||||
|
}
|
||||||
|
|
||||||
.form-row .red-ui-editor-node-label-form-row {
|
.form-row .red-ui-editor-node-label-form-row {
|
||||||
margin: 5px 0 0 50px;
|
margin: 5px 0 0 50px;
|
||||||
label {
|
label {
|
||||||
|
Loading…
Reference in New Issue
Block a user