From 29b96d8d3533cf3c624999e5c04aac7a63dc02b4 Mon Sep 17 00:00:00 2001 From: Monica Kozbial Date: Tue, 8 Dec 2020 16:21:52 -0800 Subject: [PATCH] Fix ui event checks (#4512) --- core/procedures.js | 3 ++- demos/blockfactory/workspacefactory/wfactory_init.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/procedures.js b/core/procedures.js index 876845997..a1b63be92 100644 --- a/core/procedures.js +++ b/core/procedures.js @@ -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); diff --git a/demos/blockfactory/workspacefactory/wfactory_init.js b/demos/blockfactory/workspacefactory/wfactory_init.js index 7db01d414..cb64d7f27 100644 --- a/demos/blockfactory/workspacefactory/wfactory_init.js +++ b/demos/blockfactory/workspacefactory/wfactory_init.js @@ -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