mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
f760354e82
commit
829ccc3466
@ -95,6 +95,7 @@ RED.view = (function() {
|
|||||||
let flashingNodeId;
|
let flashingNodeId;
|
||||||
|
|
||||||
var clipboard = "";
|
var clipboard = "";
|
||||||
|
let clipboardSource
|
||||||
|
|
||||||
// Note: these are the permitted status colour aliases. The actual RGB values
|
// Note: these are the permitted status colour aliases. The actual RGB values
|
||||||
// are set in the CSS - flow.scss/colors.scss
|
// are set in the CSS - flow.scss/colors.scss
|
||||||
@ -628,8 +629,8 @@ RED.view = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection);
|
RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection);
|
||||||
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();});
|
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection(true);deleteSelection();});
|
||||||
RED.actions.add("core:paste-from-internal-clipboard",function(){importNodes(clipboard,{generateIds: true, generateDefaultNames: true});});
|
RED.actions.add("core:paste-from-internal-clipboard",function(){importNodes(clipboard,{generateIds: clipboardSource === 'copy', generateDefaultNames: clipboardSource === 'copy'});});
|
||||||
|
|
||||||
RED.actions.add("core:detach-selected-nodes", function() { detachSelectedNodes() })
|
RED.actions.add("core:detach-selected-nodes", function() { detachSelectedNodes() })
|
||||||
|
|
||||||
@ -2703,7 +2704,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copySelection() {
|
function copySelection(isCut) {
|
||||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2767,6 +2768,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
clipboard = JSON.stringify(nns);
|
clipboard = JSON.stringify(nns);
|
||||||
|
clipboardSource = isCut ? 'cut' : 'copy'
|
||||||
RED.menu.setDisabled("menu-item-edit-paste", false);
|
RED.menu.setDisabled("menu-item-edit-paste", false);
|
||||||
if (nodeCount > 0) {
|
if (nodeCount > 0) {
|
||||||
RED.notify(RED._("clipboard.nodeCopied",{count:nodeCount}),{id:"clipboard"});
|
RED.notify(RED._("clipboard.nodeCopied",{count:nodeCount}),{id:"clipboard"});
|
||||||
@ -4086,7 +4088,7 @@ RED.view = (function() {
|
|||||||
var mdn = mousedown_node;
|
var mdn = mousedown_node;
|
||||||
var options = [];
|
var options = [];
|
||||||
options.push({name:"delete",disabled:(movingSet.length()===0 && selectedLinks.length() === 0),onselect:function() {deleteSelection();}});
|
options.push({name:"delete",disabled:(movingSet.length()===0 && selectedLinks.length() === 0),onselect:function() {deleteSelection();}});
|
||||||
options.push({name:"cut",disabled:(movingSet.length()===0),onselect:function() {copySelection();deleteSelection();}});
|
options.push({name:"cut",disabled:(movingSet.length()===0),onselect:function() {copySelection(true);deleteSelection();}});
|
||||||
options.push({name:"copy",disabled:(movingSet.length()===0),onselect:function() {copySelection();}});
|
options.push({name:"copy",disabled:(movingSet.length()===0),onselect:function() {copySelection();}});
|
||||||
options.push({name:"paste",disabled:(clipboard.length===0),onselect:function() {importNodes(clipboard, {generateIds: true, touchImport: true});}});
|
options.push({name:"paste",disabled:(clipboard.length===0),onselect:function() {importNodes(clipboard, {generateIds: true, touchImport: true});}});
|
||||||
options.push({name:"edit",disabled:(movingSet.length() != 1),onselect:function() { RED.editor.edit(mdn);}});
|
options.push({name:"edit",disabled:(movingSet.length() != 1),onselect:function() { RED.editor.edit(mdn);}});
|
||||||
|
Loading…
Reference in New Issue
Block a user