kopia lustrzana https://github.com/backface/turtlestitch
catch JS functions inside custom dropdown definitions
rodzic
df8956462e
commit
318bdb879e
|
@ -13,6 +13,9 @@
|
|||
* Polish, thanks, Witek!
|
||||
* new Hindi translation, thanks, Barthdry!
|
||||
|
||||
### 2021-06-11
|
||||
* byob, blocks: catch JS functions inside custom dropdown definitions
|
||||
|
||||
### 2021-06-10
|
||||
* threads: error messages in presentation mode are now shown as pop-up messages onstage
|
||||
* store: commented out modal prompt to enable JS when loading a project that uses it
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
<script src="src/morphic.js?version=2021-02-10"></script>
|
||||
<script src="src/symbols.js?version=2021-03-03"></script>
|
||||
<script src="src/widgets.js?version=2021-01-05"></script>
|
||||
<script src="src/blocks.js?version=2021-06-09"></script>
|
||||
<script src="src/blocks.js?version=2021-06-11"></script>
|
||||
<script src="src/threads.js?version=2021-06-10"></script>
|
||||
<script src="src/objects.js?version=2021-06-09"></script>
|
||||
<script src="src/gui.js?version=2021-06-10"></script>
|
||||
<script src="src/paint.js?version=2020-05-17"></script>
|
||||
<script src="src/lists.js?version=2021-03-15"></script>
|
||||
<script src="src/byob.js?version=2021-06-09"></script>
|
||||
<script src="src/byob.js?version=2021-06-11"></script>
|
||||
<script src="src/tables.js?version=2021-03-05"></script>
|
||||
<script src="src/sketch.js?version=2020-07-13"></script>
|
||||
<script src="src/video.js?version=2019-06-27"></script>
|
||||
|
|
|
@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2021-June-09';
|
||||
modules.blocks = '2021-June-11';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
@ -9099,6 +9099,10 @@ InputSlotMorph.prototype.menuFromDict = function (
|
|||
}
|
||||
|
||||
if (choices instanceof Function) {
|
||||
if (!Process.prototype.enableJS) {
|
||||
menu.addItem('JavaScript extensions for Snap!\nare turned off');
|
||||
return menu;
|
||||
}
|
||||
choices = choices.call(this);
|
||||
} else if (isString(choices)) {
|
||||
choices = this[choices]();
|
||||
|
|
|
@ -106,7 +106,7 @@ WatcherMorph, XML_Serializer, SnapTranslator*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.byob = '2021-June-09';
|
||||
modules.byob = '2021-June-11';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -347,9 +347,11 @@ CustomBlockDefinition.prototype.parseChoices = function (string) {
|
|||
if (string.match(/^function\s*\(.*\)\s*{.*\n/)) {
|
||||
// It's a JS function definition.
|
||||
// Let's extract its params and body, and return a Function out of them.
|
||||
/*
|
||||
if (!Process.prototype.enableJS) {
|
||||
throw new Error('JavaScript is not enabled');
|
||||
}
|
||||
*/
|
||||
params = string.match(/^function\s*\((.*)\)/)[1].split(',');
|
||||
body = string.split('\n').slice(1,-1).join('\n');
|
||||
return Function.apply(null, params.concat([body]));
|
||||
|
|
Ładowanie…
Reference in New Issue