1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-25 19:17:19 +00:00

Fix for list widget with an empty paragraph as inline template (#7903)

Fixes #7902
This commit is contained in:
Jeremy Ruston 2023-12-21 10:35:40 +00:00 committed by GitHub
parent d2d00ffa4d
commit e2d4388c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -109,6 +109,7 @@ ListWidget.prototype.findExplicitTemplates = function() {
this.explicitJoinTemplate = null;
this.hasTemplateInBody = false;
var searchChildren = function(childNodes) {
var foundInlineTemplate = false;
$tw.utils.each(childNodes,function(node) {
if(node.type === "list-template") {
self.explicitListTemplate = node.children;
@ -118,12 +119,14 @@ ListWidget.prototype.findExplicitTemplates = function() {
self.explicitJoinTemplate = node.children;
} else if(node.type === "element" && node.tag === "p") {
searchChildren(node.children);
foundInlineTemplate = true;
} else {
self.hasTemplateInBody = true;
foundInlineTemplate = true;
}
});
return foundInlineTemplate;
};
searchChildren(this.parseTreeNode.children);
this.hasTemplateInBody = searchChildren(this.parseTreeNode.children);
}
ListWidget.prototype.getTiddlerList = function() {

View File

@ -0,0 +1,13 @@
title: ListWidget/WithEmptyParagraphTemplate
description: List widget with an empty paragraph as inline template
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
+
title: Output
<$list filter="1"><p/></$list>
+
title: ExpectedResult
<p><p></p></p>