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

ensure workspace clean after undoing dropped node

This commit is contained in:
Steve-Mcl 2022-06-26 09:08:26 +01:00
parent 1f5588b803
commit 78327716a4
5 changed files with 8 additions and 6 deletions

View File

@ -979,13 +979,14 @@ RED.view.tools = (function() {
* - it uses `<paletteLabel> <N>` - where N is the next available integer that
* doesn't clash with any existing nodes of that type
* @param {Object} node The node to set the name of - if not provided, uses current selection
* @param {{ renameBlank: boolean, renameClash: boolean, generateHistory: boolean }} options Possible options are `renameBlank`, `renameClash` and `generateHistory`
*/
function generateNodeNames(node, options) {
options = options || {
options = Object.assign({
renameBlank: true,
renameClash: true,
generateHistory: true
}
}, options)
let nodes = node;
if (node) {
if (!Array.isArray(node)) {

View File

@ -5872,6 +5872,7 @@ RED.view = (function() {
* @private
*/
function createNode(type, x, y, z) {
const wasDirty = RED.nodes.dirty()
var m = /^subflow:(.+)$/.exec(type);
var activeSubflow = z ? RED.nodes.subflow(z) : null;
if (activeSubflow && m) {
@ -5930,7 +5931,7 @@ RED.view = (function() {
var historyEvent = {
t: "add",
nodes: [nn.id],
dirty: RED.nodes.dirty()
dirty: wasDirty
}
if (activeSubflow) {
var subflowRefresh = RED.subflow.refresh(true);

View File

@ -558,7 +558,7 @@
onadd: function() {
if (this.name === '_DEFAULT_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
RED.actions.invoke("core:generate-node-names", this, {generateHistory: false})
}
}
});

View File

@ -221,7 +221,7 @@
function onAdd() {
if (this.name === '_DEFAULT_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
RED.actions.invoke("core:generate-node-names", this, {generateHistory: false})
}
for (var i=0;i<this.links.length;i++) {
var n = RED.nodes.node(this.links[i]);

View File

@ -639,7 +639,7 @@
onadd: function() {
if (this.name === '_DEFAULT_') {
this.name = ''
RED.actions.invoke("core:generate-node-names", this)
RED.actions.invoke("core:generate-node-names", this, {generateHistory: false})
}
}
});