Fix for list widget with an empty paragraph as inline template

Fixes #7902
This commit is contained in:
Jeremy Ruston 2023-12-21 09:52:40 +00:00
parent d2d00ffa4d
commit 1dc4b6d173
2 changed files with 18 additions and 2 deletions

View File

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