From 8cc10d87d45ac0f6772dcb1819d6e13ad1b5dc4e Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 21 Dec 2013 16:11:48 +0000 Subject: [PATCH] Added missing RawWidget Fixes #298. Thanks to @buggyj for pointing it out. --- core/modules/widgets/raw.js | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 core/modules/widgets/raw.js diff --git a/core/modules/widgets/raw.js b/core/modules/widgets/raw.js new file mode 100644 index 000000000..6ea592d3e --- /dev/null +++ b/core/modules/widgets/raw.js @@ -0,0 +1,53 @@ +/*\ +title: $:/core/modules/widgets/raw.js +type: application/javascript +module-type: widget + +Raw widget + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var RawWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +RawWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +RawWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.execute(); + var div = this.document.createElement("div"); + div.innerHTML=this.parseTreeNode.html; + parent.insertBefore(div,nextSibling); + this.domNodes.push(div); +}; + +/* +Compute the internal state of the widget +*/ +RawWidget.prototype.execute = function() { +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +RawWidget.prototype.refresh = function(changedTiddlers) { + return false; +}; + +exports.raw = RawWidget; + +})();