diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index 441ccc243..6cc50896f 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -34,8 +34,10 @@ function FramedEngine(options) { this.parentNode.insertBefore(this.iframeNode,this.nextSibling); this.iframeDoc = this.iframeNode.contentWindow.document; // (Firefox requires us to put some empty content in the iframe) + var paletteTitle = this.widget.wiki.getTiddlerText("$:/palette"); + var colorScheme = this.widget.wiki.getTiddler(paletteTitle).fields["color-scheme"] || "light"; this.iframeDoc.open(); - this.iframeDoc.write(""); + this.iframeDoc.write(""); this.iframeDoc.close(); // Style the iframe this.iframeNode.className = this.dummyTextArea.className; diff --git a/core/modules/utils/parsetree.js b/core/modules/utils/parsetree.js index 52dc203e8..e056b0fdd 100644 --- a/core/modules/utils/parsetree.js +++ b/core/modules/utils/parsetree.js @@ -21,6 +21,20 @@ exports.addAttributeToParseTreeNode = function(node,name,value) { } }; +exports.getOrderedAttributesFromParseTreeNode = function(node) { + if(node.orderedAttributes) { + return node.orderedAttributes; + } else { + var attributes = []; + $tw.utils.each(node.attributes,function(attribute) { + attributes.push(attribute); + }); + return attributes.sort(function(a,b) { + return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0); + }); + } +}; + exports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) { if(node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) { return node.attributes[name].value; diff --git a/core/modules/widgets/let.js b/core/modules/widgets/let.js index b3ed89828..5c4b3aa90 100644 --- a/core/modules/widgets/let.js +++ b/core/modules/widgets/let.js @@ -48,7 +48,7 @@ LetWidget.prototype.computeAttributes = function() { var changedAttributes = {}, self = this; this.currentValueFor = Object.create(null); - $tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) { + $tw.utils.each($tw.utils.getOrderedAttributesFromParseTreeNode(this.parseTreeNode),function(attribute) { var value = self.computeAttribute(attribute), name = attribute.name; if(name.charAt(0) !== "$") { diff --git a/core/palettes/CupertinoDark.tid b/core/palettes/CupertinoDark.tid index 956602a0f..7df078296 100644 --- a/core/palettes/CupertinoDark.tid +++ b/core/palettes/CupertinoDark.tid @@ -87,7 +87,7 @@ tiddler-border: transparent tiddler-controls-foreground-hover: <> tiddler-controls-foreground-selected: <> tiddler-controls-foreground: #48484A -tiddler-editor-background: transparent +tiddler-editor-background: <> tiddler-editor-border-image: tiddler-editor-border: rgba(255, 255, 255, 0.08) tiddler-editor-fields-even: rgba(255, 255, 255, 0.1) diff --git a/editions/test/tiddlers/tests/test-widget.js b/editions/test/tiddlers/tests/test-widget.js index ac90c39c3..19848e761 100755 --- a/editions/test/tiddlers/tests/test-widget.js +++ b/editions/test/tiddlers/tests/test-widget.js @@ -143,7 +143,8 @@ describe("Widget module", function() { var wiki = new $tw.Wiki(); // Add a tiddler wiki.addTiddlers([ - {title: "TiddlerOne", text: "<$transclude tiddler='TiddlerOne'/>\n"} + {title: "TiddlerOne", text: "<$transclude tiddler='TiddlerTwo'/>\n"}, + {title: "TiddlerTwo", text: "<$transclude tiddler='TiddlerOne'/>"} ]); // Test parse tree var parseTreeNode = {type: "widget", children: [ diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 145c5f2aa..774e3ee69 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -334,6 +334,10 @@ table tfoot tr td { height: 600px; } +:root { + color-scheme: {{{ [{$:/palette}get[color-scheme]] ~light }}}; +} + /* ** Links */