Fix ui event checks (#4512)

This commit is contained in:
Monica Kozbial
2020-12-08 16:21:52 -08:00
committed by GitHub
parent 2de6c9ec7a
commit 29b96d8d35
2 changed files with 4 additions and 3 deletions

View File

@@ -293,7 +293,8 @@ Blockly.Procedures.updateMutatorFlyout_ = function(workspace) {
* @package
*/
Blockly.Procedures.mutatorOpenListener = function(e) {
if (!e.isUiEvent || e.element != 'mutatorOpen' || !e.newValue) {
if (!(e.type == Blockly.Events.BUBBLE_OPEN && e.bubbleType === 'mutator' &&
e.isOpen)) {
return;
}
var workspaceId = /** @type {string} */ (e.workspaceId);

View File

@@ -345,8 +345,8 @@ WorkspaceFactoryInit.addWorkspaceFactoryEventListeners_ = function(controller) {
// Only enable "Edit Block" when a block is selected and it has a
// surrounding parent, meaning it is nested in another block (blocks that
// are not nested in parents cannot be shadow blocks).
if (e.type == Blockly.Events.BLOCK_MOVE || (e.isUiEvent &&
e.element == 'selected')) {
if (e.type == Blockly.Events.BLOCK_MOVE ||
e.type == Blockly.Event.SELECTED) {
var selected = Blockly.selected;
// Show shadow button if a block is selected. Show "Add Shadow" if