From 0c8662bc231e553deda602f4c9ed1197d4c7293d Mon Sep 17 00:00:00 2001 From: Vincent Briglia Date: Thu, 17 May 2018 15:27:24 +0200 Subject: [PATCH] Allow override of icons per block --- .gitignore | 3 ++- src/engine/runtime.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 124efe5d7..ea69f3503 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,9 @@ npm-* /.nyc_output /coverage -# IDEA +# Editor /.idea +/.vscode # Build /dist diff --git a/src/engine/runtime.js b/src/engine/runtime.js index e55f93ec8..aae140945 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -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 };