Skip to content

Broken css classes for custom toolbox icon in 9.0.0-beta.2 #6454

@clementcontet

Description

@clementcontet

Describe the bug

After migrating from 9.0.0-beta.1 to 9.0.0-beta.2, I get an error in console when loading my workspace.
It turns out that, as in https://blocklycodelabs.dev/codelabs/custom-toolbox/index.html#0, my toolbox custom icon css contains multiple classes (see https://github.com/Orange-OpenSource/super-coding-ball/blob/blockly9/src/assets/blocks/toolbox.json#L8).

This commit (5f11f34) changed the dom.addClass method to https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add
But apparently, in case of multiple classes, one needs to split them first, and pass them separately.

To Reproduce

Steps to reproduce the behavior:

  1. Clone https://github.com/Orange-OpenSource/super-coding-ball/tree/blockly9
  2. npm force install
  3. ng serve
  4. Go to "offline play" and choose any opponent

Desktop (please complete the following information):

  • Chrome
  • Version 9.0.0-beta.2

Stack Traces

core.mjs:6485 ERROR DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('customIcon customIconEvents') contains HTML space characters, which are not valid in tokens.
    at CustomCategory.createIconDom_ (http://localhost:4200/vendor.js:10984:372)
    at CustomCategory.createDom_ (http://localhost:4200/vendor.js:10982:295)
    at CustomCategory.init (http://localhost:4200/vendor.js:10979:626)
    at Toolbox$$module$build$src$core$toolbox$toolbox.createToolboxItem_ (http://localhost:4200/vendor.js:11010:232)
    at Toolbox$$module$build$src$core$toolbox$toolbox.renderContents_ (http://localhost:4200/vendor.js:11009:348)
    at Toolbox$$module$build$src$core$toolbox$toolbox.render (http://localhost:4200/vendor.js:11009:180)
    at Toolbox$$module$build$src$core$toolbox$toolbox.init (http://localhost:4200/vendor.js:11002:349)
    at init$$module$build$src$core$inject (http://localhost:4200/vendor.js:10478:466)
    at Object.inject$$module$build$src$core$inject [as inject] (http://localhost:4200/vendor.js:10474:62)
    at BlocklyComponent.setWorkspaceForEdition (http://localhost:4200/main.js:505:63)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions