mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +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:
@@ -1366,21 +1366,22 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
|
||||
if (!existingGroup) {
|
||||
eventUtils.setGroup(true);
|
||||
}
|
||||
|
||||
let pastedThing;
|
||||
// Checks if this is JSON. JSON has a type property, while elements don't.
|
||||
if (state['type']) {
|
||||
pastedThing = this.pasteBlock_(null, state as blocks.State);
|
||||
} else {
|
||||
const xmlBlock = state as Element;
|
||||
if (xmlBlock.tagName.toLowerCase() === 'comment') {
|
||||
pastedThing = this.pasteWorkspaceComment_(xmlBlock);
|
||||
try {
|
||||
// Checks if this is JSON. JSON has a type property, while elements don't.
|
||||
if (state['type']) {
|
||||
pastedThing = this.pasteBlock_(null, state as blocks.State);
|
||||
} else {
|
||||
pastedThing = this.pasteBlock_(xmlBlock, null);
|
||||
const xmlBlock = state as Element;
|
||||
if (xmlBlock.tagName.toLowerCase() === 'comment') {
|
||||
pastedThing = this.pasteWorkspaceComment_(xmlBlock);
|
||||
} else {
|
||||
pastedThing = this.pasteBlock_(xmlBlock, null);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
eventUtils.setGroup(existingGroup);
|
||||
}
|
||||
|
||||
eventUtils.setGroup(existingGroup);
|
||||
return pastedThing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user