Please see Highlight -- Find and highlight text - #12 by Jan for context.
Clicking the Highlight button is one user action too many. Its more convenient to combine the Open and Highlight actions and trigger both with just the Open button. The code would be as follows (penultimate line added):
\define open()
<$list filter="my filter here" variable="tiddler">
<$action-navigate $to=<<tiddler>> $scroll="no"/>
</$list>
<$action-highlight text={{!!_search-text}}/>
\end
<$button actions=<<open>>>Open</$button>
This does not work as desired though. The invokeAction
functions of the action-navigate
and action-highlight
widgets are called in the right sequence, but in the user interface the highlighting occurs before the tiddlers are opened. This makes the highlighting disappear almost immediately, since by design a change in the story river clears it.
As I don’t (yet) fully understand the details of the Refreshmechanism my knowledge of TiddlyWiki is insufficient to understand/diagnose why this is the case,
The code of action-highlight is on GitHub: Highlight — Find and highlight text, in the tiddler $:/plugins/anttt/highlight-action-highlight/action-highlight.js. One notable difference between the actions is that action-highlight dispatches its event with the EventTarget.dispatchEvent
function as opposed to with TiddlyWiki’s Widget.prototype.dispatchEvent
function. I am not sure though if this is the cause of the problem. Also as of yet I have not been able to make TiddlyWiki’s dispatchEvent in action-highlight be listened to by a TiddlyWiki listener in the Highlight widget …