On Tuesday, March 10, 2020 at 4:49:33 AM UTC-7, Luis Gonzalez wrote:
>
> I've added to my foot plugin the option of collapse tiddlers. It shows a 
> little chevron icon on the view toolbar.
> If you click on the "chevron up" icon the tiddler collapses (the top 
> tiddler above). If you click the "chevron down" icon the tiddler expands.
>

The TWCore already has a "fold/unfold" button that can be shown in the View 
Toolbar.  How does your button differ?
 

> There is a problem: the tiddler status is stored in the field "hide-body" 
> in the same tiddler, so if you collapse/expand a tiddler the tiddlywiki 
> is marked as not saved.
> How can I store the status of each tiddler (it is not the same for all 
> tiddlers, so each tiddler has its own status) so that Tiddlywiki does not 
> mark it as not saved?
>

The TWCore definition for *$:/core/ui/Buttons/fold* refers to a variable, 
<<folded-state>>, which is defined in *$:/core/ui/ViewTemplate* as:

\define folded-state()
$:/state/folded/$(currentTiddler)$
\end

This variable uses the value of $(currentTiddler)$ to construct a unique 
"$:/state/folded/..." tiddler title, so that the folded/unfolded state of a 
given tiddler is stored separately.  This avoids the problem you are having 
where changing the state changes the "modified" field of the affected 
tiddler.

Note that any changes to "$:/state..." tiddlers do NOT mark the document as 
"dirty" (i.e., needing to be saved).  This is defined 
in $:/config/SaverFilter, via the "-[prefix[$:/state/]]" filter syntax.

However, even though changes to $:/state tiddlers don't mark the document 
as dirty, the $:/state tiddlers themselves are still saved when you save 
the document, so that their values are preserved across separate browser 
sessions.

As of TW5.1.22 (currently pre-release), you can suppress the *saving* of 
the $:/state/folded/... tiddlers by defining a global variable, 
$(publishFilter)$ by creating a tiddler (e.g., "$:/config/PublishFilter" -- 
or any other name you like), tagged with "$:/tags/Macro" that contains:
\define publishFilter() -[prefix[$:/state/folded]]

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki - http://TiddlyTools.com/InsideTW






will still mark the entire document as "dirty".  




>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a29f8f72-82e1-451a-92c9-479443075293%40googlegroups.com.

Reply via email to