Modal request for next version of TiddlyWiki

Hi all

I just got an idea I think would be really helpful for the next version of TiddlyWiki.

Currently modals are for viewing tiddlers. What if a tiddler could allow for a modal to be able to view a specific field of the same tiddler? This would be a great way to do

  1. footnotes
  2. sources
  3. any other hidden content

without having to resort to links, stretch text, details elements, etc.

I have been using a macro and an editor toolbar button for inserting modals to other tiddlers, but it would be much more efficient, for most needs, to be able to do something like <<modal field="footnote">> where the default would be to the current tiddler unless specified.

Lately I have been using modals much more, and previously I was using details elements, because while the wiki interlinking and backlinking is great, for longer tiddlers like outlines and longer academic material, it is very helpful to readers to be able to view hidden / parallel material while not losing one’s place in the present tiddler.

So imagine I am reading a book and want to include a summary of an idea or quote, and hide the bibliographic reference ot the source in a modal. I create and edit the tiddler, add the bibliographic data in a footnote field, then add the modal macro, then tag the tiddler to transclude it under a category. (Actually, to eliminate the second step, I always have an edit-text area in the sidebar to add the bibliographic data to the new note button while I am reading that book)

The reading experience is then, read the text of the transcluded tiddler, then click the button to see the source, without needing to go into edit mode or travel to another tiddler and navigate back to the present tiddler.

Anyway, that is just one use case. My point is just that expanding the modal to have a field parameter would allow some options for both editing and reading that could greatly enhance the TiddlyWiki experience.

1 Like

I am not sure you need to wait for the next version of tiddlywiki, just develop this on top of the current version as a plugin or tiddler package. But there other opportunities beyond modals such as windows, and I think I would more likey want a full form, to edit custom fields, to be exposed.

I will keep it in mind here [Proposal] Updating field handling functionality in TiddlyWiki

Modals are created using the tm-modal message and a button, which shows a template tiddler. So if you add a currentTiddler parameter to the tm-modal message, you can “connect” the template to any tiddler you want.

I do not see, why a next version of TW would be needed to do what you want. You need the right template in combination with the tm-modal message and it should do what you want.

Okay, since you two are insisting that modals can already be created that access a field other than the text field of the same tiddler, now with no change to TiddlyWiki, maybe the more appropriate question is, how do I express it so that what is shown in the modal is a different field?

The snippet below does not open a modal to the caption field of the tiddler Example tiddler.

<$button message="tm-modal" param="Example tiddler" field="caption">Open modal</$button>

Create a $:/temp tiddler with subtitle and text fields, like this:

<$button message="tm-modal" param="$:/temp/MyModal">Open modal
   <$action-setfield $tiddler="$:/temp/MyModal"
      subtitle="modal heading text here" text={{Example Tiddler!!caption}}/>
</$button>

see https://tiddlywiki.com/#Modals for more info about optional tm-modal fields

… and, for your desired <<modal>> macro, you can define:

\procedure modal(field)
<$button message="tm-modal" param="$:/temp/MyModal"><<field>>
   <$action-setfield $tiddler="$:/temp/MyModal"
      subtitle=<<field>> text={{{ [<currentTiddler>get<field>] }}}/>
</$button>
\end

which you can then invoke like this:

<<modal field:"footnote">>

or just

<<modal footnote>>

-e

2 Likes

Thanks Eric!

I actually saw only the first part of your reply (since I saw it in email which chopped it off) and didn’t realize you also created the macro. From your first snippet I managed to create my macro and test it just now and it works great.

Mine was the following, called modalbib to distinguish it from a modal macro that modals other tiddlers. The ‘S’ is short for ‘source’.

\define modalbib() @@.donotprint <$button class="tc-btn-invisible" message="tm-modal" param="$:/temp/MyModal"><span class="navy">^^S^^</span><$action-setfield $tiddler="$:/temp/MyModal" subtitle={{!!title}} text={{!!bibdata}} mask-closable=yes/></$button>@@

Yours has the advantage of allowing me to specify which field to draw from.

Thanks again!

1 Like

For those curious to see an example, here is a screenshot of instructions to myself that I wrote up:

I will also be uploading instructions shortly at Documenting TW — a non-linear personal web notebook

2 Likes