edit-text widget to change a field in the same tiddler

123 views
Skip to first unread message

Luis Gonzalez

unread,
Jul 22, 2019, 3:56:06 AM7/22/19
to TiddlyWiki
The documentation says:
 
" the EditTextWidget can not change properties of the tiddler it is embedded in or part of. It can only change fields of other tiddlers."


So I cannot put the code: <$edit-text field="description"/> to change the description of the tiddler. What is the correct way to change fields in the same tiddler in view mode? Transclusion does not work either.

Luis Gonzalez

unread,
Jul 22, 2019, 4:26:26 AM7/22/19
to tiddl...@googlegroups.com
With this macro you can edit as many fields as you want of the same tiddler (in View Mode). You only have to write:

* Description: <<edit-field description>>
* Caption: <<edit-field caption>>
* E-mail: <<edit-field e-mail>>

The macro uses a temporal tiddler, $:/TemporalTiddler to store temporaly the fields you edit in fields of the same name of this temporal tiddler. Here you find the macro:

\define edit-field(my_field:"description") <$reveal type="match" state="!!the_status$my_field$" text=""> {{!!$my_field$}} <$button set="!!the_status$my_field$" setTo="cambiar"> <$action-setfield $tiddler="$:/TemporalTiddler" $campo$={{!!$my_field$}}/> {{$:/core/images/edit-button}} </$button> </$reveal> <$reveal type="match" state="!!the_status$my_field$" text="cambiar"> <$edit-text tiddler="$:/TemporalTiddler" field="$my_field$" size="50"/> <$button set="!!$my_field$" setTo={{$:/TemporalTiddler!!$my_field$}}> <$action-deletefield the_status$my_field$ /> {{$:/core/images/done-button}} </$button> </$reveal> \end

Attached to the message you find a wiki with the macro running.
empty.html

Watt

unread,
Jul 22, 2019, 7:03:45 AM7/22/19
to TiddlyWiki
Nice one Luis! State tiddlers are the way to go, temporary 'storage' tiddlers that let you write their field contents back where you want it, when you want it;
https://tiddlywiki.com/#StateMechanism

The reveal is an extra refinement - thanks for sharing. Keep them coming.

Reply all
Reply to author
Forward
0 new messages