mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
fix: Don't clober event group when renaming vars (#6829)
* fix: Don't clober event group when renaming vars Also audit all existing event group commands and tweak a few of them where I think there's a potential issue.
This commit is contained in:
@@ -69,7 +69,10 @@ export class VariableMap {
|
||||
const type = variable.type;
|
||||
const conflictVar = this.getVariable(newName, type);
|
||||
const blocks = this.workspace.getAllBlocks(false);
|
||||
eventUtils.setGroup(true);
|
||||
const existingGroup = eventUtils.getGroup();
|
||||
if (!existingGroup) {
|
||||
eventUtils.setGroup(true);
|
||||
}
|
||||
try {
|
||||
// The IDs may match if the rename is a simple case change (name1 ->
|
||||
// Name1).
|
||||
@@ -80,7 +83,7 @@ export class VariableMap {
|
||||
variable, newName, conflictVar, blocks);
|
||||
}
|
||||
} finally {
|
||||
eventUtils.setGroup(false);
|
||||
eventUtils.setGroup(existingGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,9 +287,7 @@ export class VariableMap {
|
||||
}
|
||||
this.deleteVariable(variable);
|
||||
} finally {
|
||||
if (!existingGroup) {
|
||||
eventUtils.setGroup(false);
|
||||
}
|
||||
eventUtils.setGroup(existingGroup);
|
||||
}
|
||||
}
|
||||
/* End functions for variable deletion. */
|
||||
|
||||
Reference in New Issue
Block a user