From 25c73cfd15440eb0b5d32733eb26fdd080993a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Mon, 12 Aug 2024 17:38:33 +0200 Subject: [PATCH] enabled setting custom blocks labels to (nested) lists of label parts --- HISTORY.md | 5 +++++ snap.html | 2 +- src/threads.js | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 065e1ec0c..8a7a96490 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,11 @@ # Snap! (BYOB) History ## in development: +* **Notable Changes:** + * enabled setting custom blocks labels to (nested) lists of label parts, not just in DEFINE but also in SET + +### 2024-08-12 +* threads: enabled setting custom blocks labels to (nested) lists of label parts ## 10.0.2: * **Notable Fixes:** diff --git a/snap.html b/snap.html index ffdfee055..029f0b553 100755 --- a/snap.html +++ b/snap.html @@ -17,7 +17,7 @@ - + diff --git a/src/threads.js b/src/threads.js index 0221c9e10..f27969b43 100644 --- a/src/threads.js +++ b/src/threads.js @@ -65,7 +65,7 @@ StagePickerMorph, CustomBlockDefinition, CommentMorph*/ /*jshint esversion: 11, bitwise: false, evil: true*/ -modules.threads = '2024-August-05'; +modules.threads = '2024-August-12'; var ThreadManager; var Process; @@ -8404,8 +8404,16 @@ Process.prototype.doSetBlockAttribute = function (attribute, block, val) { (oldType == 'command' && rep.includes(type)); } + function labelFromList(list) { + return list.map(each => each instanceof List ? each.asWords() + : each).asTXT().replaceAll('\n', ' $nl '); + } + switch (choice) { case 'label': + if (val instanceof List) { + val = labelFromList(val); + } def.setBlockLabel(val); break; case 'comment':