\function temp-edit-box(target-field)
[[$:/temp/edit-box/]addsuffix{!!title}addsuffix[/]addsuffix<target-field>]
\end
\function temp-edit-box-value(target-field)
[<temp-edit-box>get[text]]
\end
\function target-field-value(target-field)
[<currentTiddler>get<target-field>]
\end
\procedure edit-box-actions(target-field)
<$let
target-fieldvalue={{{ [<currentTiddler>get<target-field>] }}}
>
<$action-setfield $tiddler=<<currentTiddler>> $field=<<target-field>> $value=<<target-fieldvalue>>/>
<$action-deletetiddler $tiddler=<<temp-edit-box>>/>
</$let>
\end
\procedure view-box-actions(target-field)
<$let
target-fieldvalue={{{ [<currentTiddler>get<target-field>] }}}
>
<$action-setfield $tiddler=<<temp-edit-box>> $field="text" $value=<<taregt-fieldvalue>>/>
</$let>
\end
\procedure view-box(target-field)
<$let
target-fieldvalue={{{ [<currentTiddler>get<target-field>] }}}
>
<$button actions=<<view-box-actions>> class="tc-btn-invisible"> <<target-fieldvalue>> {{$:/core/images/edit-button}}
</$button>
<br>
target field is <<target-field>>
<br>
temporary tiddler is <<temp-edit-box>>
</$let>
\end
\procedure edit-field(target-field)
<$list filter="[<temp-edit-box>is[tiddler]]" emptyMessage=<<view-box>> variable=none>
<$keyboard key="Enter" actions=<<edit-box-actions>> >
<$edit-text field=<<target-field>> placeholder="Add new entry here" default="" tag="input"/>
</$keyboard>
</$list>
\end
Here is a code I am experimenting with to create a view-cum-edit box for tiddler fields in different view templates. This is a modified version of the code in this discussion - How to prevent edit text widget used in the subtitle to not lose focus while typing
My intention is to use this procedure to display and edit the field values easily from the view-template itself by calling this procedure.
Above given is an initial partly working code. There can be other mistakes in this code.
But my question for this post is regarding the code given below
\function temp-edit-box(target-field)
[[$:/temp/edit-box/]addsuffix{!!title}addsuffix[/]addsuffix<target-field>]
\end
Why temporary tiddler created doesn’t have parameter called target-field
added as suffix. Why this is happening. Because of this issue, the procedure call is not unique for each fields. Can someone help.
Here is a demo wiki - https://edit-field.tiddlyhost.com/ .Use the Enter
key to return to view mode from edit mode