[TW5] Unexpected effect of $:/tags/Macro on the story river

80 views
Skip to first unread message

Xavier Cazin

unread,
Feb 10, 2020, 1:47:49 PM2/10/20
to TiddlyWikiDev
Hi everyone,

Did you know that when you edit and save a tiddler in the story river, the focus remains more or less on that tiddler, unless that tiddler bears the tag $:/tags/Macro ?! You can reproduce this behaviour on http://tiddlywiki.com with any browser : tag a tiddler in the middle of the story with $:/tags/Macro, open it, then save it. It will lead you above the story.

I tried with different themes and different browsers, to the same result.

I didn't find any mention of this issue in the google groups, so I'm wondering whether a well-known workaround exists or maybe global macros aren't much used among developers? Now that I seriously envision to develop a plugin for public release, this issue has become a bit annoying :-)

When I tried to figure the release where it appeared first, I found that there is a conflict between the $:/tags/Macro tag and the story river since when global macros where introduced (5.0.13-beta), but in Firefox only, where it was more like a flickering.

If you think it's not easy to fix, any lead on a workaround would much appreciated!

Thanks in advance,
-- Xavier Cazin

Mat

unread,
Feb 10, 2020, 4:23:45 PM2/10/20
to TiddlyWikiDev
It sounds like a bug but meanwhile you can perhaps add a naviation in the save tiddler button, i.e $:/core/ui/Buttons/save or to the macro that tiddler calls, i.e the save-tiddler-actions macro which is found in $:/core/ui/EditTemplate . Maybe surround it with a condition that current is tagged with $:/tags/Macro.

<:-)

Eric Shulman

unread,
Feb 10, 2020, 5:13:15 PM2/10/20
to TiddlyWikiDev
On Monday, February 10, 2020 at 10:47:49 AM UTC-8, Xavier Cazin wrote:
tag a tiddler in the middle of the story with $:/tags/Macro, open it, then save it. It will lead you above the story.

I suspect that it has to do with the way that global macros are loaded by the $:/core/ui/PageTemplate, which does the following:
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]

This line causes an automatic refresh of the PageTemplate whenever a tiddler tagged with $:/tags/Macro is changed.

-e


Xavier Cazin

unread,
Feb 11, 2020, 4:32:05 AM2/11/20
to TiddlyWikiDev
Hi Eric,
This is it! When I remove my plugin namespace from this filter, the issue disappears :-)

Thank you Eric, you saved me some hair. I'll use <$importvariables> to load my macros explicitly and I'll fill a ticket on GitHub.

--Xavier.

Xavier Cazin

unread,
Feb 11, 2020, 4:42:45 AM2/11/20
to TiddlyWikiDev
Hi Mat,

On Mon, Feb 10, 2020 at 10:23 PM Mat <matia...@gmail.com> wrote:
It sounds like a bug but meanwhile you can perhaps add a naviation in the save tiddler button, i.e $:/core/ui/Buttons/save or to the macro that tiddler calls, i.e the save-tiddler-actions macro which is found in $:/core/ui/EditTemplate . Maybe surround it with a condition that current is tagged with $:/tags/Macro.

Thank you for the suggestion, that would be a good exercise to master navigation inside the story! Having now seen Eric's answer, I'm inclined to rather try loading macros explicitly with <$importvariables>, in order to keep compatibility with as many releases as possible.

Cheers,
--Xavier.

Mat

unread,
Feb 11, 2020, 6:42:01 AM2/11/20
to TiddlyWikiDev
Xavier Cazin wrote:
I'm inclined to rather try loading macros explicitly with <$importvariables>, in order to keep compatibility with as many releases as possible.

@Eric and @Xavier
I'm hijacking the thread (since the question seems straightened out) with a long shot but: The long time problem with refresh and therefore lost focus when one is editing a maro tiddler... could this somehow be prevented using importvariables...?

<:-)

Jeremy Ruston

unread,
Feb 11, 2020, 7:35:19 AM2/11/20
to TiddlyWikiDev
Hi Mat

On 11 Feb 2020, at 11:42, Mat <matia...@gmail.com> wrote:

I'm hijacking the thread (since the question seems straightened out) with a long shot but: The long time problem with refresh and therefore lost focus when one is editing a maro tiddler... could this somehow be prevented using importvariables…?

The long time problem with the refresh mechanism is that it doesn’t maintain certain state when widgets are deleted and recreated as part of the refresh cycle (selection status, focus, scroll positions, the state of summary/detail widgets etc).

Xavier’s specific problem here is that changing a global macro tiddler causes the entire page template to be reconstructed, losing the focus status.

The lack of state preservation is a major flaw that I’d like to see fixed. We have some proposals for partial solutions that work for some state in some situations, but we really need a rethink that makes state preservation just work. One possibility is adopting a more conventional virtual DOM strategy for updating the DOM.

Best wishes

Jeremy.


Mat

unread,
Feb 11, 2020, 8:18:20 AM2/11/20
to TiddlyWikiDev
Thanks for info, Jeremy.

<:-)

TonyM

unread,
Feb 18, 2020, 6:00:31 PM2/18/20
to TiddlyWikiDev
Jeremy,

Can we not provide an edit-text widget equivalent (or feature) that when invoked in currentTiddler allows editing the fields outside the refresh mechanism and defers refresh to when the tiddler is saved, closed etc...?

  • Whilst I know there are technical issues that must be addressed I feel overcoming this will empower users to use tiddlers as forms much more easily. Creative design techniques are required here, all I can say is as an observer is its a barrier to tiddlywiki use.
  • The Draft mechanism was designed to solve a problem at the time and still has its place, but I can't help but feel it has this negative side effect.
  • Of course I now know, how to work around it, but despite doing it multiple times, I have still not being able to make a user friendly solution I can share with newbees. As raised before it is cognitively complex.
  • It seems to me that if tiddlywiki refreshes its tree by design, that surely we can provide a mechanism to defer it.

Here is my hair brained idea, potentially ill informed speculation
  • Is it possible to get the current tiddler/input field to exist within the standard DOM even if we need a trigger to submit it to tiddlywikis DOM
  • Could this facilitate the introduction of more advanced html in tiddlers such as onclick in tiddlers or able to access script inserted with raw tags?
  • I imagine a way to have html that on "submit" can create a tiddler containing the results. 
  • This would open tiddlywiki to leverage the considerable library of forms and pages available on the internet.
Regards
Tony
Reply all
Reply to author
Forward
0 new messages