don't show codification and js-func blocks in search results unless enabled

snap7
jmoenig 2021-10-26 15:00:49 +02:00
rodzic 705e061f0d
commit 3227d6aea9
3 zmienionych plików z 28 dodań i 3 usunięć

Wyświetl plik

@ -19,6 +19,7 @@
* libraries no longer rely on the JSF primitive, project may need to re-import their libraries to run without having to enable JS extensions
* bulk hide/show arbitrary blocks in the palette via the palette's context menu (instead of the primitive blocks' context menus)
* hidden blocks don't appear in search results / keyboard input options
* codification and js-func blocks don't appear in search results unless enabled
* made BROADCAST blocks expandable and added a second input for message receivers, default is "all"
* migrated SEND blocks to be BROADCAST TO blocks
* "when I receive 'any message'" hat scripts are threadsafe (uninterruptable by other messages)
@ -45,6 +46,9 @@
* German
* Chinese, thanks, Simon!
### 2021-10-26
* objects: don't show codification and js-func blocks in search results unless enabled
### 2021-10-25
* byob: fixed #2902

Wyświetl plik

@ -18,7 +18,7 @@
<script src="src/widgets.js?version=2021-07-21"></script>
<script src="src/blocks.js?version=2021-10-22"></script>
<script src="src/threads.js?version=2021-10-22"></script>
<script src="src/objects.js?version=2021-10-22"></script>
<script src="src/objects.js?version=2021-10-26"></script>
<script src="src/scenes.js?version=2021-10-12"></script>
<script src="src/gui.js?version=2021-10-20"></script>
<script src="src/paint.js?version=2021-07-05"></script>

Wyświetl plik

@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/
/*jshint esversion: 6*/
modules.objects = '2021-October-22';
modules.objects = '2021-October-26';
var SpriteMorph;
var StageMorph;
@ -3187,6 +3187,24 @@ SpriteMorph.prototype.isHidingBlock = function (aBlock) {
return StageMorph.prototype.hiddenPrimitives[aBlock.selector] === true;
};
SpriteMorph.prototype.isDisablingBlock = function (aBlock) {
// show or hide certain kinds of blocks in search results only
// if they are enabled
var sel = aBlock.selector;
if (sel === 'reportJSFunction') {
return !Process.prototype.enableJS;
}
if (
sel === 'doMapCodeOrHeader' ||
sel === 'doMapValueCode' ||
sel === 'doMapListCode' ||
sel === 'reportMappedCode'
) {
return !StageMorph.prototype.enableCodeMapping;
}
return false;
};
SpriteMorph.prototype.changeBlockVisibility = function (aBlock, hideIt, quick) {
var ide, dict, cat;
if (aBlock.isCustomBlock) {
@ -3343,7 +3361,10 @@ SpriteMorph.prototype.blocksMatching = function (
}
blocks.sort((x, y) => x[1] < y[1] ? -1 : 1);
blocks = blocks.map(each => each[0]);
return blocks.filter(each => !this.isHidingBlock(each));
return blocks.filter(each =>
!this.isHidingBlock(each) &&
!this.isDisablingBlock(each)
);
};
SpriteMorph.prototype.searchBlocks = function (