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.

<!-- Eric Shulman, https://groups.google.com/g/tiddlywiki/c/2WWN0Lf0G-E, 
alt. -->

<$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>

On Wednesday, November 25, 2020 at 7:57:14 PM UTC-6 Eric Shulman wrote:

> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d9dacd27-bdc7-4756-ada7-f71a6c086945n%40googlegroups.com.

Reply via email to