Skip to content

Commit

Permalink
fix: bumping a block after duplicate breaking undo (#5844)
Browse files Browse the repository at this point in the history
* fix: bumping a block after duplicate breaking undo

* fix: fixup dependencies
  • Loading branch information
BeksOmega committed Jan 6, 2022
1 parent 8a71f87 commit 5204569
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 0 additions & 3 deletions core/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
goog.module('Blockly.clipboard');

const eventUtils = goog.require('Blockly.Events.utils');
/* eslint-disable-next-line no-unused-vars */
const {ICopyable} = goog.requireType('Blockly.ICopyable');

Expand Down Expand Up @@ -55,9 +54,7 @@ const paste = function() {
}
if (copyData.typeCounts &&
workspace.isCapacityAvailable(copyData.typeCounts)) {
eventUtils.setGroup(true);
workspace.paste(copyData.saveInfo);
eventUtils.setGroup(false);
return true;
}
return false;
Expand Down
7 changes: 7 additions & 0 deletions core/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,11 @@ WorkspaceSvg.prototype.paste = function(state) {
this.currentGesture_.cancel(); // Dragging while pasting? No.
}

const existingGroup = eventUtils.getGroup();
if (!existingGroup) {
eventUtils.setGroup(true);
}

// Checks if this is JSON. JSON has a type property, while elements don't.
if (state['type']) {
this.pasteBlock_(null, /** @type {!blocks.State} */ (state));
Expand All @@ -1535,6 +1540,8 @@ WorkspaceSvg.prototype.paste = function(state) {
this.pasteBlock_(xmlBlock, null);
}
}

eventUtils.setGroup(existingGroup);
};

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/deps.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5204569

Please sign in to comment.