TiddlyWiki5
TiddlyWiki5 copied to clipboard
A Field View Template
Discussed in https://github.com/Jermolene/TiddlyWiki5/discussions/6803
Originally posted by kookma July 20, 2022 In TW 5.2.2 and older version, I used a template like below to display fields in view mode
<$vars newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">>
newFieldValueTiddler=<<qualify "$:/temp/NewFieldValue">>
searchListState=<<qualify "$:/temp/searchListState">>
storeTitle=<<qualify "$:/temp/storeTitle">>
>
<$transclude tiddler="$:/core/ui/EditTemplate/fields"/>
</$vars>
In TW 5.2.3p, this does not work, so I followed to see what has been changed and released https://github.com/Jermolene/TiddlyWiki5/pull/6628 has been merged. It adds a feature to keep the input value when the filed name is changed. I updated my template to reflect this
\import [[$:/core/ui/EditTemplate]]
<!-- the above import required from TW5.2.3-->
<$reveal type=match stateTiddler stateTitle="$:/state/utility/view-fields" stateField=text default="hide" text=show tag=div class="kk-ut-viewfields">
<$vars newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">>
newFieldValueTiddler=<<qualify "$:/temp/NewFieldValue">>
newFieldNameInputTiddler=<<qualify "$:/temp/NewFieldName/input">>
newFieldNameSelectionTiddler=<<qualify "$:/temp/NewFieldName/selected-item">>
searchListState=<<qualify "$:/temp/searchListState">>
storeTitle=<<qualify "$:/temp/storeTitle">>
>
<$transclude tiddler="$:/core/ui/EditTemplate/fields"/>
</$vars>
</$reveal>
To give a try, open https://tiddlywiki.com/prerelease/, create a tiddler with above code and tag with $:/tags/ViewTemplate
Then create a new tiddler, save and try add a field. TW UI crashes.
I am wondering what else happened to $:/core/ui/EditTemplate/fields
that the solution does not work anymore.
Any idea?
My response from #6803
Hi @kookma that's disappointing. As you know, we try to retain rigorous backwards compatibility. #6511 has given us a few problems – #6628 is actually to fix a change in UI behaviour that was introduced in #6511.
We could fix the issue you raise here by ensuring that
$:/core/ui/EditTemplate/fields
applies default values for missing parameters. I'll convert it to an issue.
We could fix the issue you raise here by ensuring that
$:/core/ui/EditTemplate/fields
applies default values for missing parameters. I'll convert it to an issue.
This is good! and I think following and debugging the code is better (more simple).