This page is part of a static HTML representation of the TiddlyWiki at
https://tiddlywiki.com/dev/
Widget refresh demo II
17th February 2019 at 12:55am
[ { "title": "$:/DefaultTiddlers", "text": "[[tiddler field widget]]" } ] [ { "title": "test", "text": "type new text here" } ] [ { "title": "tiddlerfield.js", "text": "/*\\\n\nHello, World widget\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar MyWidget = function(parseTreeNode, options) {\n\tthis.initialise(parseTreeNode, options);\n};\n\n/*\nInherit from the base widget class\n*/\nMyWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nMyWidget.prototype.render = function(parent, nextSibling) {\n\tthis.parentDomNode = parent;\n\tvar text = this.wiki.getTiddlerText(\"test\", \"<empty>\")\n\tvar textNode = this.document.createTextNode(text);\n\tparent.insertBefore(textNode, nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nA widget with optimized performance will selectively refresh, but here we refresh always\n*/\nMyWidget.prototype.refresh = function(changedTiddlers) {\n\t// Regenerate and rerender the widget and\n\t// replace the existing DOM node\n\tthis.refreshSelf();\n\treturn true;\n};\n\nexports.tiddlerfield = MyWidget;\n\n})();\n", "created": "20190202032530728", "modified": "20190202032700995", "module-type": "widget", "tags": "", "type": "application/javascript" } ] [ { "title": "tiddler field widget", "text": "\n<$edit-text focus=yes tiddler=test tag=input/>\n \n<div>\n<div style=\"display:inline-block;width: 49%;vertical-align: text-top;word-wrap: break-word;}\">\n\n```\n<$tiddlerfield/>\n```\n\nRenders as:\n\n<$tiddlerfield/>\n</div>\n<div style=\"display:inline-block;width: 49%;vertical-align: text-top;word-wrap: break-word;}\">\n\n```\n<$view tiddler=\"test\"/>\n```\n\nRenders as:\n\n<$view tiddler=\"test\"/>\n</div>\n" } ]