From 78ed53f4fba241217062fdca0c30862e0dc42ff4 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 4 Jul 2022 20:46:21 +0100 Subject: [PATCH] Ensure a second paste of cut nodes is treated as a copy-paste --- .../@node-red/editor-client/src/js/ui/view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index d24445deb..224f0a6f6 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -630,7 +630,9 @@ RED.view = (function() { RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection); 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: clipboardSource === 'copy', generateDefaultNames: clipboardSource === 'copy'});}); + 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() }) @@ -2150,6 +2152,9 @@ RED.view = (function() { } } if (mouse_mode == RED.state.IMPORT_DRAGGING) { + if (clipboardSource === 'cut') { + clipboardSource = 'copy' + } updateActiveNodes(); RED.nodes.dirty(true); } @@ -3479,6 +3484,9 @@ RED.view = (function() { updateSelection(); RED.nodes.dirty(true); redraw(); + if (clipboardSource === 'cut') { + clipboardSource = 'copy' + } resetMouseVars(); d3.event.stopPropagation(); return;