feat: add types for accessing icons. (#7132)

* feat: add types for accessing icons.

* chore: PR comments
This commit is contained in:
Beka Westberg
2023-06-13 14:39:36 -07:00
committed by GitHub
parent 22a7a7bbab
commit 0cfd388a5d
15 changed files with 72 additions and 60 deletions

View File

@@ -14,7 +14,7 @@ goog.declareModuleId('Blockly.Events.BlockChange');
import type {Block} from '../block.js';
import type {BlockSvg} from '../block_svg.js';
import {MUTATOR_TYPE} from '../icons/icon_types.js';
import {IconType} from '../icons/icon_types.js';
import {hasBubble} from '../interfaces/i_has_bubble.js';
import * as registry from '../registry.js';
import * as utilsXml from '../utils/xml.js';
@@ -146,7 +146,7 @@ export class BlockChange extends BlockBase {
);
}
// Assume the block is rendered so that then we can check.
const icon = block.getIcon(MUTATOR_TYPE);
const icon = block.getIcon(IconType.MUTATOR);
if (icon && hasBubble(icon) && icon.bubbleIsVisible()) {
// Close the mutator (if open) since we don't want to update it.
icon.setBubbleVisible(false);