From 81654e72997c1577181d6729660c110ed1b9e20f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 15 Nov 2013 11:18:45 +0100 Subject: „read-only“ option for editable custom block input slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also custom block input slots reverting to default now show their default value (useful in combination with the new "read-only" option --- store.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'store.js') diff --git a/store.js b/store.js index 0032919..5a5605f 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2013-November-12'; +modules.store = '2013-November-15'; // XML_Serializer /////////////////////////////////////////////////////// @@ -749,7 +749,8 @@ SnapSerializer.prototype.loadCustomBlocks = function ( definition.declarations[names[i]] = [ child.attributes.type, child.contents, - options ? options.contents : undefined + options ? options.contents : undefined, + child.attributes.readonly === 'true' ]; }); } @@ -1663,13 +1664,15 @@ CustomBlockDefinition.prototype.toXML = function (serializer) { this.codeMapping || '', Object.keys(this.declarations).reduce(function (xml, decl) { return xml + serializer.format( - '$%', + '$%', myself.declarations[decl][0], + myself.declarations[decl][3] ? + ' readonly="true"' : '', myself.declarations[decl][1], myself.declarations[decl][2] ? - '' + myself.declarations[decl][2] + - '' - : '' + '' + myself.declarations[decl][2] + + '' + : '' ); }, ''), this.body ? serializer.store(this.body.expression) : '', -- cgit v1.3.1