Fix adding users to history if multiple props modified

This commit is contained in:
GogoVega 2024-06-26 09:22:01 +02:00
parent 53e092e484
commit ed4b98b598
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -1534,6 +1534,7 @@ RED.editor = (function() {
if (scope) {
const newUsers = editing_config_node.users.filter(function (node) {
let keepNode = false;
let nodeModified = null;
for (const d in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(d)) {
@ -1544,15 +1545,19 @@ RED.editor = (function() {
// this config node in the correct scope.
keepNode = true;
} else {
historyEvents.push({
t: "edit",
node: node,
changes: { [d]: node[d] },
changed: node.changed,
dirty: node.dirty
});
if (!nodeModified) {
nodeModified = {
t: "edit",
node: node,
changes: { [d]: node[d] },
changed: node.changed,
dirty: node.dirty
};
} else {
nodeModified.changes[d] = node[d];
}
// Remove the reference to the config
// Remove the reference to the config node
node[d] = "";
}
}
@ -1560,6 +1565,11 @@ RED.editor = (function() {
}
}
// Add the node modified to the history
if (nodeModified) {
historyEvents.push(nodeModified);
}
// Mark as changed and revalidate this node
if (!keepNode) {
node.changed = true;