Allow override of icons per block

This commit is contained in:
Vincent Briglia 2018-05-17 15:27:24 +02:00
parent 82fd6f0d2f
commit 0c8662bc23
2 changed files with 8 additions and 3 deletions

3
.gitignore vendored
View file

@ -10,8 +10,9 @@ npm-*
/.nyc_output
/coverage
# IDEA
# Editor
/.idea
/.vscode
# Build
/dist

View file

@ -649,11 +649,15 @@ class Runtime extends EventEmitter {
};
// If an icon for the extension exists, prepend it to each block, with a vertical separator.
if (categoryInfo.blockIconURI) {
// We can overspecify an icon for each block, but if no icon exists on a block, fall back to
// the category block icon.
const iconURI = blockInfo.blockIconURI || categoryInfo.blockIconURI;
if (iconURI) {
blockJSON.message0 = '%1 %2';
const iconJSON = {
type: 'field_image',
src: categoryInfo.blockIconURI,
src: iconURI,
width: 40,
height: 40
};