The refresh occurs because the PageTemplate (defined in $:/core/ui/PageTemplate
) includes this line:
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
This line is what actually causes “global” macros to be available to all other tiddlers.
As you can see, the second “run” in the filter imports macro definitions from all shadows+tiddlers
that are tagged with $:/tags/Macro
, except for those tiddlers that have the draft.of
field.
Thus, when editing a macro tiddler via an $edit-text
widget in a ViewTemplate, it triggers a refresh every time the tiddler content is changed (i.e. on each keystroke) but NOT when “editing this kind of tiddler in the standard way” since editing a tiddler actually creates a temporary tiddler - “Draft of …”, which has the draft.of
field set.
Perhaps you could try emulating this TWCore behavior by wrapping your $edit-text
widget within an $eventcatcher
widget… something like this:
<$eventcatcher
$focusin="""<$action-setfield $tiddler=<<targetTiddler>> draft.of="yes"/>"""
$focusout="""<$action-deletefield $tiddler=<<targetTiddler>> draft.of/>""">
In this way, you could still make changes to the contents of <<targetTiddler>>
, but since it will be marked with a draft.of
field, it won’t be an “active” macro until the focus moves away from the $edit-text
input.
-e