diff --git a/examples/backpack-demo/package-lock.json b/examples/backpack-demo/package-lock.json index ef01677323..1cfd12e5c0 100644 --- a/examples/backpack-demo/package-lock.json +++ b/examples/backpack-demo/package-lock.json @@ -8427,9 +8427,9 @@ } }, "blockly": { - "version": "5.20210325.1", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-5.20210325.1.tgz", - "integrity": "sha512-qrilYPovJeDfxKDWm1YBUCPVNElh/iyC1szaHTIPZHj9C9YPpSzZOeFyyrPBbYRudzbo8kjBOWMtHnN1bLjkoQ==", + "version": "5.20210624.0-beta.3", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-5.20210624.0-beta.3.tgz", + "integrity": "sha512-t12+Qi7Q6+s97v1TFyGixqJUxW8W08QAw+Jr0BXMh7+9GguyA+QlHtlIFrJxyccfB5yqmAA9VCtLcZT/042Fww==", "requires": { "jsdom": "15.2.1" } @@ -8736,16 +8736,16 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" }, "mime-db": { - "version": "1.47.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==" + "version": "1.48.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", + "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==" }, "mime-types": { - "version": "2.1.30", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", + "version": "2.1.31", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", + "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", "requires": { - "mime-db": "1.47.0" + "mime-db": "1.48.0" } }, "nwsapi": { @@ -9037,9 +9037,9 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" }, "ws": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", - "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==" + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" }, "xml-name-validator": { "version": "3.0.0", diff --git a/examples/backpack-demo/package.json b/examples/backpack-demo/package.json index 77f12a0afd..1e9506d554 100644 --- a/examples/backpack-demo/package.json +++ b/examples/backpack-demo/package.json @@ -14,7 +14,7 @@ ] }, "dependencies": { - "blockly": "^5.20210325.0", + "blockly": "^5.20210624.0-beta.2", "@blockly/workspace-backpack": "file:../../plugins/workspace-backpack" } } diff --git a/plugins/workspace-backpack/package-lock.json b/plugins/workspace-backpack/package-lock.json index 0709058f55..b9389731d4 100644 --- a/plugins/workspace-backpack/package-lock.json +++ b/plugins/workspace-backpack/package-lock.json @@ -1972,9 +1972,9 @@ "dev": true }, "blockly": { - "version": "5.20210325.1", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-5.20210325.1.tgz", - "integrity": "sha512-qrilYPovJeDfxKDWm1YBUCPVNElh/iyC1szaHTIPZHj9C9YPpSzZOeFyyrPBbYRudzbo8kjBOWMtHnN1bLjkoQ==", + "version": "5.20210624.0-beta.3", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-5.20210624.0-beta.3.tgz", + "integrity": "sha512-t12+Qi7Q6+s97v1TFyGixqJUxW8W08QAw+Jr0BXMh7+9GguyA+QlHtlIFrJxyccfB5yqmAA9VCtLcZT/042Fww==", "dev": true, "requires": { "jsdom": "15.2.1" @@ -5215,9 +5215,9 @@ }, "dependencies": { "ws": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", - "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "dev": true } } diff --git a/plugins/workspace-backpack/package.json b/plugins/workspace-backpack/package.json index 8877c5a3de..06a1777988 100644 --- a/plugins/workspace-backpack/package.json +++ b/plugins/workspace-backpack/package.json @@ -43,10 +43,10 @@ "devDependencies": { "@blockly/dev-scripts": "^1.2.6", "@blockly/dev-tools": "^2.2.1", - "blockly": "^5.20210325.1" + "blockly": "^5.20210624.0-beta.2" }, "peerDependencies": { - "blockly": ">=5.20210325.1" + "blockly": ">=5.20210624.0-beta.2" }, "publishConfig": {}, "eslintConfig": { diff --git a/plugins/workspace-backpack/src/backpack.js b/plugins/workspace-backpack/src/backpack.js index 9aba3d536b..5c73e27f7b 100644 --- a/plugins/workspace-backpack/src/backpack.js +++ b/plugins/workspace-backpack/src/backpack.js @@ -15,22 +15,25 @@ import {BackpackChange, BackpackOpen} from './ui_events'; import { BackpackContextMenuOptions, BackpackOptions, parseOptions, } from './options'; -import './backpack_monkey_patch'; /** * Class for backpack that can be used save blocks from the workspace for * future use. * @param {!Blockly.WorkspaceSvg} workspace The workspace to sit in. + * @implements {Blockly.IAutoHideable} * @implements {Blockly.IPositionable} + * @extends {Blockly.DragTarget} */ -export class Backpack { +export class Backpack extends Blockly.DragTarget { /** * Constructor for a backpack. * @param {!Blockly.WorkspaceSvg} targetWorkspace The target workspace that - * the plugin will be added to. + * the backpack will be added to. * @param {!BackpackOptions=} backpackOptions The backpack options to use. */ constructor(targetWorkspace, backpackOptions) { + super(); + /** * The workspace. * @type {!Blockly.WorkspaceSvg} @@ -38,9 +41,11 @@ export class Backpack { */ this.workspace_ = targetWorkspace; - // This set is part of the monkeypatch, so that a reference to the backpack - // can be accessed on a given workspace. - this.workspace_.backpack = this; + /** + * The unique id for this component. + * @type {string} + */ + this.id = 'backpack'; /** * The backpack options. @@ -157,11 +162,14 @@ export class Backpack { * Initializes the backpack. */ init() { - this.workspace_.getPluginManager().addPlugin({ - id: 'backpack', - plugin: this, + this.workspace_.getComponentManager().addComponent({ + component: this, weight: 2, - types: [Blockly.PluginManager.Type.POSITIONABLE], + capabilities: [ + Blockly.ComponentManager.Capability.AUTOHIDEABLE, + Blockly.ComponentManager.Capability.DRAG_TARGET, + Blockly.ComponentManager.Capability.POSITIONABLE, + ], }); this.initFlyout_(); this.createDom_(); @@ -282,9 +290,9 @@ export class Backpack { this.addEvent_( this.svgGroup_, 'mouseup', this, this.onClick_); this.addEvent_( - this.svgGroup_, 'mouseover', this, this.onDragEnter); + this.svgGroup_, 'mouseover', this, this.onMouseOver_); this.addEvent_( - this.svgGroup_, 'mouseout', this, this.onDragExit); + this.svgGroup_, 'mouseout', this, this.onMouseOut_); } /** @@ -296,11 +304,7 @@ export class Backpack { * @private */ addEvent_(node, name, thisObject, func) { - // bindEventWithChecks_ quashes events too aggressively. See: - // https://groups.google.com/forum/#!topic/blockly/QF4yB9Wx00s - // Using bindEventWithChecks_ for blocking mousedown causes issue in mobile. - // See #4303 - const event = Blockly.bindEvent_(node, name, thisObject, func); + const event = Blockly.browserEvents.bind(node, name, thisObject, func); this.boundEvents_.push(event); } @@ -315,10 +319,11 @@ export class Backpack { /** * Returns the bounding rectangle of the drag target area in pixel units - * relative to the Blockly injection div. - * @return {!Blockly.utils.Rect} The plugin’s bounding box. + * relative to viewport. + * @return {?Blockly.utils.Rect} The component's bounding box. Null if drag + * target area should be ignored. */ - getTargetArea() { + getClientRect() { if (!this.svgGroup_) { return null; } @@ -334,7 +339,7 @@ export class Backpack { /** * Returns the bounding rectangle of the UI element in pixel units relative to * the Blockly injection div. - * @return {!Blockly.utils.Rect} The plugin’s bounding box. + * @return {!Blockly.utils.Rect} The component’s bounding box. */ getBoundingRectangle() { return new Blockly.utils.Rect( @@ -427,11 +432,15 @@ export class Backpack { } /** - * Handles a block drop on this backpack. - * @param {!Blockly.BlockSvg} block The block being dropped on the backpack. + * Handles when a block or bubble is dropped on this component. + * Should not handle delete here. + * @param {!Blockly.IDraggable} dragElement The block or bubble currently + * being dragged. */ - handleBlockDrop(block) { - this.addBlock(block); + onDrop(dragElement) { + if (dragElement instanceof Blockly.BlockSvg) { + this.addBlock(/** @type {!Blockly.BlockSvg} */ (dragElement)); + } } /** * Converts the provided block into a cleaned XML string. @@ -615,6 +624,19 @@ export class Backpack { Blockly.Events.fire(new BackpackOpen(false, this.workspace_.id)); } + /** + * Hides the component. Called in Blockly.hideChaff. + * @param {boolean} onlyClosePopups Whether only popups should be closed. + * Flyouts should not be closed if this is true. + */ + autoHide(onlyClosePopups) { + // The backpack flyout always autocloses because it overlays the backpack UI + // (no backpack to click to close it). + if (!onlyClosePopups) { + this.close(); + } + } + /** * Handle click event. * @param {!MouseEvent} e Mouse event. @@ -631,19 +653,70 @@ export class Backpack { } /** - * Handle mouse over. + * Handles when a cursor with a block or bubble enters this drag target. + * @param {!Blockly.IDraggable} dragElement The block or bubble currently + * being dragged. + */ + onDragEnter(dragElement) { + if (dragElement instanceof Blockly.BlockSvg) { + this.updateHoverStying_(true); + } + } + + /** + * Handles when a cursor with a block or bubble exits this drag target. + * @param {!Blockly.IDraggable} _dragElement The block or bubble currently + * being dragged. + */ + onDragExit(_dragElement) { + this.updateHoverStying_(false); + } + + /** + * Handles a mouseover event. + * @private + */ + onMouseOver_() { + if (this.isOpenable_()) { + this.updateHoverStying_(true); + } + } + + /** + * Handles a mouseout event. + * @private + */ + onMouseOut_() { + this.updateHoverStying_(false); + } + + /** + * Adds or removes styling to darken the backpack to show it is interactable. + * @param {boolean} addClass True to add styling, false to remove. + * @protected */ - onDragEnter() { - Blockly.utils.dom.addClass( - /** @type {!SVGElement} */ (this.svgImg_), 'blocklyBackpackDarken'); + updateHoverStying_(addClass) { + const backpackDarken = 'blocklyBackpackDarken'; + if (addClass) { + Blockly.utils.dom.addClass( + /** @type {!SVGElement} */ (this.svgImg_), backpackDarken); + } else { + Blockly.utils.dom.removeClass( + /** @type {!SVGElement} */ (this.svgImg_), backpackDarken); + } } /** - * Handle mouse exit. + * Returns whether the provided block or bubble should not be moved after + * being dropped on this component. If true, the element will return to where + * it was when the drag started. + * @param {!Blockly.IDraggable} dragElement The block or bubble currently + * being dragged. + * @return {boolean} Whether the block or bubble provided should be returned + * to drag start. */ - onDragExit() { - Blockly.utils.dom.removeClass( - /** @type {!SVGElement} */ (this.svgImg_), 'blocklyBackpackDarken'); + shouldPreventMove(dragElement) { + return dragElement instanceof Blockly.BlockSvg; } /** @@ -680,7 +753,7 @@ Blockly.Css.register([ `.blocklyBackpack { opacity: .4; } - .blocklyBackpack:hover, .blocklyBackpackDarken { + .blocklyBackpackDarken { opacity: .6; } .blocklyBackpack:active { diff --git a/plugins/workspace-backpack/src/backpack_helpers.js b/plugins/workspace-backpack/src/backpack_helpers.js index 34c6114c88..b87b567b40 100644 --- a/plugins/workspace-backpack/src/backpack_helpers.js +++ b/plugins/workspace-backpack/src/backpack_helpers.js @@ -21,8 +21,8 @@ import './msg'; function registerEmptyBackpack(workspace) { const prevConfigureContextMenu = workspace.configureContextMenu; workspace.configureContextMenu = (menuOptions, e) => { - const backpack = workspace.backpack; - if (!backpack || !backpack.getTargetArea().contains(e.clientX, e.clientY)) { + const backpack = workspace.getComponentManager().getComponent('backpack'); + if (!backpack || !backpack.getClientRect().contains(e.clientX, e.clientY)) { prevConfigureContextMenu && prevConfigureContextMenu.call(null, menuOptions, e); return; @@ -51,9 +51,10 @@ function registerRemoveFromBackpack() { preconditionFn: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.block.workspace; - if (ws.isFlyout && ws.targetWorkspace && !! ws.targetWorkspace.backpack) { - const backpack = ws.targetWorkspace.backpack; - if (backpack.getFlyout().getWorkspace().id === ws.id) { + if (ws.isFlyout && ws.targetWorkspace) { + const backpack = + ws.targetWorkspace.getComponentManager().getComponent('backpack'); + if (backpack && backpack.getFlyout().getWorkspace().id === ws.id) { return 'enabled'; } } @@ -61,7 +62,8 @@ function registerRemoveFromBackpack() { }, callback: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { - const backpack = scope.block.workspace.targetWorkspace.backpack; + const backpack =scope.block.workspace.targetWorkspace + .getComponentManager().getComponent('backpack'); backpack.removeBlock(scope.block); }, scopeType: Blockly.ContextMenuRegistry.ScopeType.BLOCK, @@ -87,23 +89,29 @@ function registerCopyToBackpack(disablePreconditionContainsCheck) { if (!scope.block) { return; } - const backpackCount = scope.block.workspace.backpack.getCount(); + const backpack = scope.block.workspace.getComponentManager() + .getComponent('backpack'); + const backpackCount = backpack.getCount(); return `${Blockly.Msg['COPY_TO_BACKPACK']} (${backpackCount})`; }, preconditionFn: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.block.workspace; - if (!ws.isFlyout && !!ws.backpack) { - if (disablePreconditionContainsCheck) { - return 'enabled'; + if (!ws.isFlyout) { + const backpack = ws.getComponentManager().getComponent('backpack'); + if (backpack) { + if (disablePreconditionContainsCheck) { + return 'enabled'; + } + return backpack.containsBlock(scope.block) ? 'disabled' : 'enabled'; } - return ws.backpack.containsBlock(scope.block) ? 'disabled' : 'enabled'; } return 'hidden'; }, callback: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { - const backpack = scope.block.workspace.backpack; + const backpack = + scope.block.workspace.getComponentManager().getComponent('backpack'); backpack.addBlock(scope.block); }, scopeType: Blockly.ContextMenuRegistry.ScopeType.BLOCK, @@ -127,15 +135,19 @@ function registerCopyAllBackpack() { preconditionFn: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.workspace; - if (!ws.isFlyout && !!ws.backpack) { - return 'enabled'; + if (!ws.isFlyout) { + const backpack = ws.getComponentManager().getComponent('backpack'); + if (backpack) { + return 'enabled'; + } } return 'hidden'; }, callback: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.workspace; - ws.backpack.addBlocks(ws.getTopBlocks()); + const backpack = ws.getComponentManager().getComponent('backpack'); + backpack.addBlocks(ws.getTopBlocks()); }, scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE, id: 'copy_all_to_backpack', @@ -159,21 +171,27 @@ function registerPasteAllBackpack() { if (!scope.workspace) { return; } - const backpackCount = scope.workspace.backpack.getCount(); + const backpack = + scope.workspace.getComponentManager().getComponent('backpack'); + const backpackCount = backpack.getCount(); return `${Blockly.Msg['PASTE_ALL_FROM_BACKPACK']} (${backpackCount})`; }, preconditionFn: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.workspace; - if (!ws.isFlyout && !!ws.backpack) { - return 'enabled'; + if (!ws.isFlyout) { + const backpack = ws.getComponentManager().getComponent('backpack'); + if (backpack) { + return 'enabled'; + } } return 'hidden'; }, callback: function( /** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) { const ws = scope.workspace; - const contents = ws.backpack.getContents(); + const backpack = ws.getComponentManager().getComponent('backpack'); + const contents = backpack.getContents(); contents.forEach((blockText) => { const block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(blockText), ws); diff --git a/plugins/workspace-backpack/src/backpack_monkey_patch.js b/plugins/workspace-backpack/src/backpack_monkey_patch.js deleted file mode 100644 index 047fb2af08..0000000000 --- a/plugins/workspace-backpack/src/backpack_monkey_patch.js +++ /dev/null @@ -1,145 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @fileoverview A monkeypatch in Blockly to support a backpack. - * @author kozbial@google.com (Monica Kozbial) - */ -import * as Blockly from 'blockly/core'; - - -// TODO: No way to do this currently without monkeypatching Blockly. -(() => { - /* eslint-disable no-import-assign */ - /** - * Close tooltips, context menus, dropdown selections, etc. - * @param {boolean=} opt_allowToolbox If true, don't close the toolbox. - */ - Blockly.hideChaff = function(opt_allowToolbox) { - Blockly.Tooltip.hide(); - Blockly.WidgetDiv.hide(); - Blockly.DropDownDiv.hideWithoutAnimation(); - if (!opt_allowToolbox) { - const workspace = Blockly.getMainWorkspace(); - // For now the trashcan flyout always autocloses because it overlays the - // trashcan UI (no trashcan to click to close it). - if (workspace.trashcan && - workspace.trashcan.flyout) { - workspace.trashcan.closeFlyout(); - } - const toolbox = workspace.getToolbox(); - if (toolbox && - toolbox.getFlyout() && - toolbox.getFlyout().autoClose) { - toolbox.clearSelection(); - } - if (workspace.backpack) { - workspace.backpack.close(); - } - } - }; - - /** - * Execute a step of block dragging, based on the given event. Update the - * display accordingly. - * @param {!Event} e The most recent move event. - * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer - * has moved from the position at the start of the drag, in pixel units. - * @package - */ - Blockly.BlockDragger.prototype.dragBlock = function(e, currentDragDeltaXY) { - const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY); - const newLoc = Blockly.utils.Coordinate.sum(this.startXY_, delta); - - this.draggingBlock_.moveDuringDrag(newLoc); - this.dragIcons_(delta); - - // start monkeypatch edit - if (this.workspace_.backpack && - this.workspace_.backpack.getTargetArea() - .contains(e.clientX, e.clientY)) { - if (!this.isOverBackpack_) { - this.workspace_.backpack.onDragEnter(); - } - this.isOverBackpack_ = true; - this.deleteArea_ = Blockly.DELETE_AREA_NONE; - } else { - if (this.isOverBackpack_) { - this.workspace_.backpack.onDragExit(); - } - this.isOverBackpack_ = false; - this.deleteArea_ = this.workspace_.isDeleteArea(e); - } - // end Monkeypatch edit - - this.draggedConnectionManager_.update(delta, this.deleteArea_); - - this.updateCursorDuringBlockDrag_(); - }; - - /** - * Finish a block drag and put the block back on the workspace. - * @param {!Event} e The mouseup/touchend event. - * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer - * has moved from the position at the start of the drag, in pixel units. - * @package - */ - Blockly.BlockDragger.prototype.endBlockDrag = function( - e, currentDragDeltaXY) { - // Make sure internal state is fresh. - this.dragBlock(e, currentDragDeltaXY); - this.dragIconData_ = []; - this.fireDragEndEvent_(); - - Blockly.utils.dom.stopTextWidthCache(); - - Blockly.blockAnimations.disconnectUiStop(); - - // start monkeypatch edit - let delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY); - const newLoc = this.isOverBackpack_ ? - this.startXY_ : Blockly.utils.Coordinate.sum(this.startXY_, delta); - delta = Blockly.utils.Coordinate.difference(newLoc, this.startXY_); - this.draggingBlock_.moveOffDragSurface(newLoc); - - if (this.isOverBackpack_) { - // Handle adding to Backpack - const backpack = this.workspace_.backpack; - backpack.handleBlockDrop(this.draggingBlock_); - // Blocks dragged directly from a flyout may need to be bumped. - Blockly.bumpObjectIntoBounds_( - this.draggingBlock_.workspace, - this.workspace_.getMetricsManager() - .getScrollMetrics(true), this.draggingBlock_); - } - // end monkeypatch edit - - const deleted = this.maybeDeleteBlock_(); - if (!deleted) { - // These are expensive and don't need to be done if we're deleting. - this.draggingBlock_.moveConnections(delta.x, delta.y); - this.draggingBlock_.setDragging(false); - this.fireMoveEvent_(); - if (this.draggedConnectionManager_.wouldConnectBlock()) { - // Applying connections also rerenders the relevant blocks. - this.draggedConnectionManager_.applyConnections(); - } else { - this.draggingBlock_.render(); - } - this.draggingBlock_.scheduleSnapAndBump(); - } - this.workspace_.setResizesEnabled(true); - - const toolbox = this.workspace_.getToolbox(); - if (toolbox && typeof toolbox.removeStyle == 'function') { - const style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' : - 'blocklyToolboxGrab'; - toolbox.removeStyle(style); - } - Blockly.Events.setGroup(false); - }; - /* eslint-enable no-import-assign */ -})();