The handling for the “done” button is defined by the save-tiddler-actions()
macro in $:/core/ui/EditTemplate
. Thus, to set the wordcount when the “done” button is pressed, just add the following line at the beginning of the save-tiddler-actions()
macro:
<$action-setfield wordcount={{{ [<currentTiddler>get[text]splitregexp[\s+]count[]] }}}/>
Alternatively, you could put the above line of code into a separate tiddler (e.g., $:/MyDoneActions
) and then transclude that tiddler at the beginning of the save-tiddler-actions()
macro, like this:
{{||$:/MyDoneActions}}
Note the use of ||
in the transclusion, so that the $action-setfield
widget is applied to the current tiddler being saved. By putting the extra actions into a separate tiddler, it allows you to easily add actions without having to make more direct changes to the $:/core/ui/EditTemplate
tiddler.
enjoy,
-e