Saving a story-river

151 views
Skip to first unread message

ad...@menswellbeing.org

unread,
Nov 25, 2020, 8:01:52 PM11/25/20
to TiddlyWiki
Hi there,

Thanks to those posters who pointed out it is possible to drag-and-drop tiddlers in the "Open" side-bar to re-order tiddlers in the story-river.

Is it possible to save the story-river into a tiddler and then use that tiddler to open that story-river at a later time? As you might guess I'm looking to save a few custom story-rivers, one for each "audience" of readers.

Scott.

Joshua Fontany

unread,
Nov 25, 2020, 8:42:13 PM11/25/20
to TiddlyWiki
Yes, but there is no pre-built UI for doing so.

Setup a $button to copy the $:/StoryList tiddler to another name, driven by a text-input field (that points to a `$:/temp/StoryListTitle` title). Transclude that title for the button actions. Also in the actions, add a tag like `StoryList` to each saved StoryList tiddler.

Then, setup a dropdown widget that gets a list of tiddlers tagged `StoryList`, and saves the selected one to `$:/temp/StoryListSelected`.
Then have a button with actions that transclude that title, and use that to save a copy AS $:/StoryList (overwriting the current $:/StoryList).

Best,
Joshua F

Eric Shulman

unread,
Nov 25, 2020, 8:57:14 PM11/25/20
to TiddlyWiki
On Wednesday, November 25, 2020 at 5:01:52 PM UTC-8 ad...@menswellbeing.org wrote:
Is it possible to save the story-river into a tiddler and then use that tiddler to open that story-river at a later time?

The current StoryRiver contents are stored in $:/StoryList!!list.

Here's a tiddler that defines two buttons...
one to save the current  $:/StoryList!!list field to a separate tiddler tagged with "savedStory",
and another to set the  $:/StoryList!!list from the list field in a "savedStory" tiddler:

StorySaver:
<$button popup="$:/state/popup/savestory"> save story </$button>
<$reveal type="popup" state="$:/state/popup/savestory" class="tc-drop-down tc-popup-keep" style="min-width:auto;padding:0.5em;">
   Enter a new story name:<br>
   <$edit-text tiddler="$:/state/popup/savestory" field="storyname" /><br>
   <$list filter="[tag[savedStory]limit[1]]">
      or, select an existing story:<br>
      <style> .savedStoryList { width:100%; } </style>
      <$select tiddler="$:/state/popup/savestory" field="storyname" size="5" class="savedStoryList">
      <$list filter="[tag[savedStory]]"><option><<currentTiddler>></option></$list>
      </$select>
   </$list>
   <$button style="text-align:center;"> save
      <$action-setfield $tiddler={{$:/state/popup/savestory!!storyname}} list={{$:/StoryList!!list}} tags="savedStory" />
      <$action-deletetiddler $tiddler="$:/state/popup/savestory" />
   </$button>
</$reveal>
<$button popup="$:/state/popup/loadstory"> load story </$button>
<$reveal type="popup" state="$:/state/popup/loadstory" class="tc-drop-down tc-popup-keep" style="min-width:auto;padding:0.5em;">
   <$list filter="[tag[savedStory]limit[1]]" emptyMessage="no saved stories">
      select an existing story:<br>
      <style> .savedStoryList { width:100%; } </style>
      <$select tiddler="$:/state/popup/loadstory" field="storyname" size="5" class="savedStoryList">
      <$list filter="[tag[savedStory]]"><option><<currentTiddler>></option></$list>
      </$select>
   </$list>
   <$button style="text-align:center;"> load
      <$action-setfield $tiddler="$:/StoryList" list={{{ [{$:/state/popup/loadstory!!storyname}get[list]] }}} />
      <$action-deletetiddler $tiddler="$:/state/popup/loadstory" />
   </$button>
</$reveal>

To use these buttons, just insert {{StorySaver}} into any tiddler.  Alternatively, you can add these buttons to the Sidebar by tagging the above tiddler with $:/tags/SideBarSegment.  After tagging, you can reposition the buttons in the SideBar by viewing the tiddler and clicking on the $:/tags/SideBarSegment tag to display the list of tiddlers with that tag.  You can then use drag-and-drop to move the buttons to the desired position in the list (e.g.,  above the $:/core/ui/SideBarSegments/tabs)

enjoy,
-e

ad...@menswellbeing.org

unread,
Nov 25, 2020, 9:35:58 PM11/25/20
to TiddlyWiki
I enjoy very much!

Thank you 😀

Atronoush

unread,
Nov 26, 2020, 4:44:17 AM11/26/20
to TiddlyWiki
Wonderful job!

I think it worth to have a sidebar tab as Story! and then see list of saved story the button to load and save!
and even an export story! This makes it great to distribute notes/docs/trails to other.


--Mohammad

Joshua Fontany

unread,
Nov 26, 2020, 5:09:33 PM11/26/20
to TiddlyWiki
Nice work Eric!!!

Sylvain Naudin

unread,
Nov 29, 2020, 2:54:58 AM11/29/20
to TiddlyWiki

soren.b...@gmail.com

unread,
Nov 29, 2020, 11:07:18 AM11/29/20
to TiddlyWiki
Thanks Scott for the suggestion and Eric for the implementation, this will be really useful!

Here's a version with a couple of tweaks:
  • Added icons to the buttons.
  • You can export the tiddlers in a story (the OK button in the export popup looks goofy because the export macro I used doesn't have an option to change the button appearance...didn't feel like it was worth making my own copy of the macro to fix this, but if someone knows a simpler solution I'm all ears).
  • Stories are saved with a prefix (e.g., $:/StorySaver/saved) rather than as the unmodified name of the story. The prefix used for this and for the tag applied to saved stories is configurable via a variable at the top of the tiddler.
One additional tweak that might be useful would be preventing the story-saver tiddler itself from being saved. I don't care because I put it in the sidebar at the bottom of the Open tab, so I won't normally have it open, but others might.


<$set name=savedStoryTag value="$:/sib/StorySaver/SavedStory">
<$set name=savedStoryPrefix value="$:/sib/StorySaver/saved/">
<$button popup="$:/state/popup/savestory"> {{$:/core/images/save-button}} save story </$button>
<$reveal type="popup" state="$:/state/popup/savestory" class="tc-drop-down tc-popup-keep" style="min-width:auto;padding:0.5em;">
   Enter a new story name:<br>
   <$edit-text tiddler="$:/state/popup/savestory" field="storyname" /><br>
   <$list filter="[tag<savedStoryTag>limit[1]]">
      or, select an existing story:<br>
      <style> .savedStoryList { width:100%; } </style>
      <$select tiddler="$:/state/popup/savestory" field="storyname" size="5" class="savedStoryList">
      <$list filter="[tag<savedStoryTag>removeprefix<savedStoryPrefix>]"><option><<currentTiddler>></option></$list>
      </$select>
   </$list>
   <$button style="text-align:center;"> save
      <$action-setfield $tiddler={{{ [{$:/state/popup/savestory!!storyname}addprefix<savedStoryPrefix>] }}} list={{$:/StoryList!!list}} tags=<<savedStoryTag>> />
      <$action-deletetiddler $tiddler="$:/state/popup/savestory" />
   </$button>
</$reveal>
<$button popup="$:/state/popup/loadstory"> {{$:/core/images/storyview-classic}} load story </$button>
<$reveal type="popup" state="$:/state/popup/loadstory" class="tc-drop-down tc-popup-keep" style="min-width:auto;padding:0.5em;">
   <$list filter="[tag<savedStoryTag>limit[1]]" emptyMessage="no saved stories">
      select an existing story:<br>
      <style> .savedStoryList { width:100%; } </style>
      <$select tiddler="$:/state/popup/loadstory" field="storyname" size="5" class="savedStoryList">
      <$list filter="[tag<savedStoryTag>removeprefix<savedStoryPrefix>]"><option><<currentTiddler>></option></$list>
      </$select>
   </$list>
   <$button style="text-align:center;"> load
      <$action-setfield $tiddler="$:/StoryList" list={{{ [{$:/state/popup/loadstory!!storyname}addprefix<savedStoryPrefix>get[list]] }}} />
      <$action-deletetiddler $tiddler="$:/state/popup/loadstory" />
   </$button>
</$reveal>

<$button popup="$:/state/popup/exportstory"> {{$:/core/images/export-button}} export story </$button>
<$reveal type="popup" state="$:/state/popup/exportstory" class="tc-drop-down tc-popup-keep" style="min-width:auto;padding:0.5em;">
   <$list filter="[tag<savedStoryTag>limit[1]]" emptyMessage="no saved stories">
      select an existing story:<br>
      <style> .savedStoryList { width:100%; } </style>
      <$select tiddler="$:/state/popup/exportstory" field="storyname" size="5" class="savedStoryList">
      <$list filter="[tag<savedStoryTag>removeprefix<savedStoryPrefix>]"><option><<currentTiddler>></option></$list>
      </$select>
   </$list>
<$macrocall $name="exportButton" exportFilter={{{ [{$:/state/popup/exportstory!!storyname}addprefix<savedStoryPrefix>get[list]] }}} lingoBase="$:/language/Buttons/ExportTiddlers/"/>
</$reveal>
</$set>
</$set>
Reply all
Reply to author
Forward
0 new messages