1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-02 06:19:57 +00:00

fix: void node need to handle its children

This commit is contained in:
lin onetwo 2024-08-05 02:31:16 +08:00
parent d6b9d00ef7
commit 6ac9592bd7
3 changed files with 11 additions and 5 deletions

View File

@ -25,7 +25,7 @@ Note that the syntax for comments is simplified to an opening "<!--" sequence an
"use strict";
exports.name = "commentblock";
exports.types = {block:true};
exports.types = {block: true, pragma: true};
exports.init = function(parser) {
this.parser = parser;
@ -56,6 +56,7 @@ exports.parse = function() {
var commentText = this.parser.source.slice(commentStart, commentEnd);
return [{
type: "void",
children: [],
text: commentText,
start: commentStart,
end: commentEnd

View File

@ -64,6 +64,7 @@ exports.parse = function() {
}
return [{
type: "void",
children: [],
parseAsInline: this.parser.parseAsInline,
start: start,
end: this.parser.pos

View File

@ -3,7 +3,7 @@ title: $:/core/modules/widgets/Void.js
type: application/javascript
module-type: widget
Void widget that is not intended for render.
Void widget that is not intended for render. It still renders all its children.
\*/
(function(){
@ -27,21 +27,25 @@ VoidNodeWidget.prototype = new Widget();
Render this widget into the DOM
*/
VoidNodeWidget.prototype.render = function(parent,nextSibling) {
// Nothing to do for a void node
// Nothing to do for a void node, but render the children. Nodes generated by pragma rules are holding everything below it in the children.
this.parentDomNode = parent;
this.execute();
this.renderChildren(parent,nextSibling);
};
/*
Compute the internal state of the widget
*/
VoidNodeWidget.prototype.execute = function() {
// Nothing to do for a void node
// Nothing to do for a void node, but 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
*/
VoidNodeWidget.prototype.refresh = function(changedTiddlers) {
return false;
return this.refreshChildren(changedTiddlers);
};
exports.void = VoidNodeWidget;