mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-23 14:30:02 +00:00
viewHandler should not be a widget
This commit is contained in:
parent
87635f8548
commit
186c5a89ad
@ -18,35 +18,35 @@ var ViewWidget = function(parseTreeNode,options) {
|
|||||||
this.initialise(parseTreeNode,options);
|
this.initialise(parseTreeNode,options);
|
||||||
};
|
};
|
||||||
|
|
||||||
var ViewHandler = function(parseTreeNode,options) {
|
|
||||||
this.initialise(parseTreeNode,options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Inherit from the base widget class
|
Inherit from the base widget class
|
||||||
*/
|
*/
|
||||||
ViewWidget.prototype = new Widget();
|
ViewWidget.prototype = new Widget();
|
||||||
|
|
||||||
/*
|
var ViewHandler = function(options) {
|
||||||
Inherit from the base widget class
|
this.document = options.document,
|
||||||
*/
|
this.title = options.title,
|
||||||
ViewHandler.prototype = new Widget();
|
this.field = options.field,
|
||||||
|
this.index = options.index,
|
||||||
|
this.mode = options.mode,
|
||||||
|
this.subTiddler = options.subTiddler,
|
||||||
|
this.text = options.text || "",
|
||||||
|
this.viewFormat = options.format,
|
||||||
|
this.wiki = options.wiki,
|
||||||
|
this.parentWidget = options.widget,
|
||||||
|
this.domNodes = [];
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
ViewHandler.prototype.render = function(parent,nextSibling) {
|
||||||
Render this widget into the DOM
|
|
||||||
*/
|
|
||||||
ViewHandler.prototype.render = function(parent,nextSibling,options) {
|
|
||||||
this.parentDomNode = parent;
|
this.parentDomNode = parent;
|
||||||
this.fakeWidget = this.wiki.makeTranscludeWidget(options.title,{
|
this.fakeWidget = this.wiki.makeTranscludeWidget(this.title,{
|
||||||
document: $tw.fakeDocument,
|
document: $tw.fakeDocument,
|
||||||
field: options.field,
|
field: this.field,
|
||||||
index: options.index,
|
index: this.index,
|
||||||
parseAsInline: options.mode !== "block",
|
parseAsInline: this.mode !== "block",
|
||||||
parentWidget: this,
|
parentWidget: this.parentWidget,
|
||||||
subTiddler: options.subTiddler
|
subTiddler: this.subTiddler
|
||||||
});
|
});
|
||||||
this.text = options.text || "";
|
|
||||||
this.viewFormat = options.format;
|
|
||||||
this.fakeNode = $tw.fakeDocument.createElement("div");
|
this.fakeNode = $tw.fakeDocument.createElement("div");
|
||||||
this.fakeWidget.makeChildWidgets();
|
this.fakeWidget.makeChildWidgets();
|
||||||
this.fakeWidget.renderChildren(this.fakeNode,null);
|
this.fakeWidget.renderChildren(this.fakeNode,null);
|
||||||
@ -97,15 +97,13 @@ ViewWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
index: this.viewIndex,
|
index: this.viewIndex,
|
||||||
format: this.viewFormat,
|
format: this.viewFormat,
|
||||||
template: this.viewTemplate,
|
template: this.viewTemplate,
|
||||||
mode: this.viewMode
|
mode: this.viewMode,
|
||||||
}
|
widget: this,
|
||||||
this.viewHandler = new ViewHandler(this.parseTreeNode,{
|
|
||||||
wiki: this.wiki,
|
wiki: this.wiki,
|
||||||
parentWidget: this,
|
|
||||||
document: this.document
|
document: this.document
|
||||||
});
|
}
|
||||||
this.viewHandler.render(parent,nextSibling,options);
|
this.viewHandler = new ViewHandler(options);
|
||||||
//this.viewHandler.render(parent,nextSibling,options);
|
this.viewHandler.render(parent,nextSibling);
|
||||||
} else if(this.text) {
|
} else if(this.text) {
|
||||||
var textNode = this.document.createTextNode(this.text);
|
var textNode = this.document.createTextNode(this.text);
|
||||||
parent.insertBefore(textNode,nextSibling);
|
parent.insertBefore(textNode,nextSibling);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user