Does th-page-refreshed fire before modals are updated?

Indeed, you’re quite right, the Dynannotate plugin does work in modals and new windows (I was confusing myself with the Dynaview plugin which does have those restrictions).

@jeremyruston: I have to say, the $dynannotate search highlight functionality is pretty sweet. It’s so much easier to integrate than mark.js was, where I had to keep track of all the active marks via a DOM window property…
:heart_eyes:

For anyone looking to do the same, I found this combination with the equally great $genesis widget pretty useful to conditionally wrap text (e.g. the body ViewTemplate) in a $dynannotate only if a search term has been set (via a state tiddler):

<$let dynannotateText={{{ [<currentTiddler>addprefix[$:/temp/dynannotate/]get[text]] }}}>
    <$genesis $type={{{ [<dynannotateText>!is[blank]then[$dynannotate]] }}} search=<<dynannotateText>> searchDisplay="overlay" searchMode="words" searchCaseSensitive="no">
        content to apply highlighting to goes here
    </$genesis>
</$let>

One would then use e.g. the inputActions of an $edit-text widget to set the text of the state tiddler to the text within the input, thus making $genesis generate a $dynannotate which in turn highlights instances of the input text within its content.
If there is no input, $dynannotate is not even generated.

Caveat emptor: This only works with $genesis from 5.2.6-prerelease onward. Older versions will throw an RSoE when the $type attribute is empty, instead of just rendering the content. Also, searchMode “words” will (hopefully) be added to Dynannotate with PR #7260 - until then use “normal”.

Have a nice day
Yaisog

PS: This has drifted so far from the OP that maybe someone should split this off…

1 Like

Thanks @Yaisog. It would be well worth updating the demo that is included with the Dynannotate plugin to use the same technique, if you’d be able to make a PR?

Hi @jeremyruston, as much as I’d like to take home the PR crown this week, I’d just add this to PR #7260, if that’s alright with you…

Update: Done and done. Take a look – I changed the View Template example quite considerably…