mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-10-13 11:31:43 +00:00
Introduce testcase widget so that we can reuse testcases as documentation examples
There's still a bit to do: adding tabs to the source panel of the testcase display, and tweaking the CSS.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/innerwiki/anchor.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Anchor widget to represent an innerwiki graphical anchor. Clone of the data widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.anchor = require("$:/core/modules/widgets/data.js").data;
|
||||
|
||||
})();
|
||||
@@ -1,58 +0,0 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/innerwiki/data.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Widget to represent a single item of data
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var DataWidget = function(parseTreeNode,options) {
|
||||
this.dataWidgetTag = parseTreeNode.type;
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
DataWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
DataWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
DataWidget.prototype.execute = function() {
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
DataWidget.prototype.refresh = function(changedTiddlers) {
|
||||
// Refresh our attributes
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh our children
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
exports.data = DataWidget;
|
||||
exports.anchor = DataWidget;
|
||||
|
||||
})();
|
||||
@@ -15,7 +15,7 @@ Widget to display an innerwiki in an iframe
|
||||
var DEFAULT_INNERWIKI_TEMPLATE = "$:/plugins/tiddlywiki/innerwiki/template";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget,
|
||||
DataWidget = require("$:/plugins/tiddlywiki/innerwiki/data.js").data,
|
||||
DataWidget = require("$:/core/modules/widgets/data.js").data,
|
||||
dm = $tw.utils.domMaker;
|
||||
|
||||
var InnerWikiWidget = function(parseTreeNode,options) {
|
||||
|
||||
Reference in New Issue
Block a user