fix: procedure param edits breaking undo (#5845)

This commit is contained in:
Beka Westberg
2022-01-04 18:07:41 -05:00
committed by GitHub
parent 835fb02343
commit 8a71f87950

View File

@@ -419,7 +419,10 @@ Mutator.prototype.updateWorkspace_ = function() {
// When the mutator's workspace changes, update the source block.
if (this.rootBlock_.workspace === this.workspace_) {
eventUtils.setGroup(true);
const existingGroup = eventUtils.getGroup();
if (!existingGroup) {
eventUtils.setGroup(true);
}
const block = /** @type {!BlockSvg} */ (this.block_);
const oldExtraState = BlockChange.getExtraBlockState_(block);
@@ -444,11 +447,12 @@ Mutator.prototype.updateWorkspace_ = function() {
eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))(
block, 'mutation', null, oldExtraState, newExtraState));
// Ensure that any bump is part of this mutation's event group.
const group = eventUtils.getGroup();
const mutationGroup = eventUtils.getGroup();
setTimeout(function() {
eventUtils.setGroup(group);
const oldGroup = eventUtils.getGroup();
eventUtils.setGroup(mutationGroup);
block.bumpNeighbours();
eventUtils.setGroup(false);
eventUtils.setGroup(oldGroup);
}, internalConstants.BUMP_DELAY);
}
@@ -457,7 +461,7 @@ Mutator.prototype.updateWorkspace_ = function() {
if (!this.workspace_.isDragging()) {
this.resizeBubble_();
}
eventUtils.setGroup(false);
eventUtils.setGroup(existingGroup);
}
};