Section Editor Plugin: First Stable Release

@Springer if you are desperate for an outliner the alternative is streams of course Streams — on TiddlyWiki 5.2.2

Personally I also;

  • change $:/config/sq/streams/new-node-title to
    • $:/streams/<<stream-root-title>>/<<now "[UTC]YYYY0MM0DD0hh0mm0ssXXX">>
      to hide the subtiddlers which have ugly titles from recent and search
  • Add to that the streams fusion, to merge a stream into a tiddler text field if desired
  • And streams is well designed for hacking and customisation.

Tones,
Sorry I missed this reply.

I’ve watched streams from a bit of a distance, like a language that others can speak fluently. Perhaps if I were starting tiddly life from scratch, streams would be of interest as an editor (though my impression is it’s still not so strong on GUI for non-author visitors). I’m now so attached to working with meaningful tiddler titles (which then appear on my sidebar lists, which I use constantly) that a different approach is a personal non-starter.

My reservation about the section-editor (as it stands now) is just that it looks as if it allows fully nested hierarchical structure (with good visitor-oriented GUI available), but then doesn’t quite behave that way. It’s still an exciting project!

@Springer keep in mind Section editor is just that and not intended to be hierarchical.

On streams it is very close to a common UI that a few notes would help users navigate it.

  • Once configured one can start with +, just type, hit enter to finish an item, tab and shift tab to indent/(undent?), click to edit.

I would recommend Streams as a basis for innovations on top of it as its open, configurable and extensible/hackable. You could also use streams fusion to move the stream into the root tiddler and then add new features on top of that.

@Mohammad Is it possible to expand and collapse all the sections together, may be by using another button ?

It has been done already. I forgot who did this.
You can add a button through viewtemplate. Note SE uses temptiddler to expand / collapse a section.

@Mohammad is this the discussion that you were talking about

That thread explains the mechanism, but one user has created the button!
You can do it now!

I’m starting to use this plugin and I like it! But how to change the default behaviour so that the “foldstate” is closed for all sections when opening the tiddler? In my case when i open the tiddler which contains several sections, all sections are expanded by default…

@Mohammad can you give some hints about which state tiddler target is to be targeted when craeting a button to hide and reveal all the sections together.

See this post

1 Like

you could try this: (if you have changed to using state tiddlers)

<$button>
<$list filter="[prefix[$:/state/section-editor/foldstate/changelog/]]">
<$action-setfield text="closed"/>
</$list>
button to set foldstate tiddlers for changelog to closed
</$button>

but only works if the state tiddler already exists, i.e. the section has been closed at least once

<$button>
<$list filter="[prefix[$:/state/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>
button to set foldstate tiddlers for all tiddlers to closed
</$button>

but only works if the state tiddler already exists, i.e. the section has been closed at least once

code for use in a tiddler tagged with $:/tags/StartupAction (see https://tiddlywiki.com/#StartupActions for others) that will run when the tiddlywiki is started; but only works if the state tiddler already exists, i.e. the section has been closed at least once:

<$list filter="[prefix[$:/state/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>

NB this closes all the state tiddlers, even ones you might want left open.

it’s probably possible to add exceptions in the filter e.g. tag a particular foldstate tiddler and filter excluding that tag. though not very practical if you edit your tiddlers often, as the state tiddlers are actually not for particular sections, they are for the sections-in-the-order-in-the-tiddler i.e. if you insert a section between 1 and 2, the new 1.5 section “takes” the state tiddler of the old 2.

2 Likes

@makiaea Thank you. Based on your suggestions, I created two buttons to fold and unfold all sections

<$button class=<<tv-config-toolbar-class>> >
<$list filter="[prefix[$:/temp/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>
{{$:/images/icon-park/abstract/app-switch-fill}}
</$button>
<$button class=<<tv-config-toolbar-class>> >
<$list filter="[prefix[$:/temp/section-editor/foldstate/]]">
<$action-deletefield $field="text"/>
</$list>
{{$:/images/icon-park/abstract/app-switch-outline}}
</$button>

How to make these buttons appear only in the viewtoolbar of tiddlers with field se-type

Thank you for your code. Your buttons works for me.
Do you know how to create only one button with a toggle function ? (open all / close all sections)

I tried, but didn’t succeed. May be someone else can help regarding this…

<$list filter="[all[current]has[se-type]]" >
<$button class=<<tv-config-toolbar-class>> >
<$list filter="[prefix[$:/state/section-editor/foldstate/]]">
<$action-setfield text="closed"/>
</$list>
{{$:/images/icon-park/abstract/app-switch-fill}}
</$button>
</$list>

I tried this code to make these buttons to appear on the viewtoolbar of tiddlers with field se-type only, but its not working as intended. Any suggestions ?

1 Like

If the field se-type contains a value (not empty) it seems to work but i don’t understand why…

The has[se-type] filter succeeds only if the se-type field has a non-blank value.
To test for the existence of the se-type field, even if blank, you need to add the :field suffix, like this:

<$list filter="[all[current]has:field[se-type]]">
2 Likes

Thank you Eric for this explanation !

Section editor has got a new update. This is a maintenance release.

Release 1.1.1

Demo: Section Editor — create, edit, fold, manage sections
Code: GitHub - kookma/TW-Section: create, edit and manage big and lengthy tiddlers through sectioning

3 Likes

@Mohammad
Just an Idea that came to my mind today - Is it possible to set the number of levels of headings to be used in each tiddler separately by assigning the that number as fieldvalue to the fieldname se-type. By this way we can avoid setting the number of levels globally. Is it possible to do ?

1 Like