New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix list widget when widget body used as template while $list-empty
specified
#7810
Conversation
If `<$list-empty>` is specified but `<$list-template>` is not, and the contents of the list widget are used as the template instead, then the result should be the same as if the emptyMessage attribute had been used.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I think there is a problem with P-tag creation. IMO the code contains way too much handling for P-tag edge-cases. All the special handling in this PR is fighting symptoms and does not fix the underlaying problem the TW syntax has with redundant P-tag creation. |
@Jermolene - I would appreciate a review of this PR, because it's blocking #7694 (comment). That is, I could work further on #7694, adding a |
@pmario - You're right about the So yes, TW's handling of paragraph tags could use some looking at. I don't have time to do it at the moment, though. |
I think it's about 5 lines in 1 file to fix the problem core/modules/parsers/wikiparser/wikiparser.js. It fixes a lot of problems with the TW DOM structure, but it also makes some problems visible that have been covered by erroneous P-tags. The linked PR contains 112 test tiddlers where we need to have a closer look. |
Since parse tree nodes never change after widget creation (whereas attribute values *can* change), we can safely search for the explicit list templtaes only once, at widget creation time. This saves time as the search doesn't have to be done on each re-render, and also allows us to safely do a clone-and-mutate step to extract the list widget's body (if any) without any `$list-empty` or other items. That, in turn, allows using the list widget's body as the template even if `$list-empty` is specified inside the widget body.
Now that #7827 is working, closing this one in favor of #7827 which @Jermolene prefers. Will reopen if @Jermolene asks me to, of course. |
If
<$list-empty>
is specified but<$list-template>
is not, and the contents of the list widget are used as the template instead, then the result should be the same as if the emptyMessage attribute had been used.Fixes #7804.