1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 22:33:16 +00:00

Add fold others button

This commit is contained in:
Jermolene 2015-08-09 12:56:48 +01:00
parent c91c7b7cbb
commit bad4a19f8e
4 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,11 @@
title: $:/core/images/fold-others-button
tags: $:/tags/Image
<svg class="tc-image-fold-others tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
<g fill-rule="evenodd">
<rect x="0" y="69" width="128" height="16" rx="8"></rect>
<rect x="0" y="43" width="128" height="16" rx="8"></rect>
<path d="M101.657101,114.348843 C100.207918,112.898639 98.2051847,112 95.9929031,112 L72,112 L72,88.0070969 C72,85.7964515 71.1036108,83.7937171 69.6545293,82.3441246 L69.6571005,82.3488427 C68.2079177,80.8986387 66.2051847,80 63.9929031,80 L32.0070969,80 C27.5881712,80 24,83.581722 24,88 C24,92.4092877 27.5848994,96 32.0070969,96 L56,96 L56,119.992903 C56,122.203549 56.8963895,124.206283 58.3454713,125.655876 L58.3429,125.651158 C59.7920828,127.101361 61.7948156,128 64.0070969,128 L88,128 L88,151.992903 C88,156.411829 91.581722,160 96,160 C100.409288,160 104,156.415101 104,151.992903 L104,120.007097 C104,117.796452 103.103611,115.793717 101.654529,114.344125 Z" id="Rectangle-440" transform="translate(64.000000, 120.000000) rotate(-45.000000) translate(-64.000000, -120.000000) "></path>
<path d="M101.657101,2.34884273 C100.207918,0.898638749 98.2051847,0 95.9929031,0 L72,7.10542736e-15 L72,-23.9929031 C72,-26.2035485 71.1036108,-28.2062829 69.6545293,-29.6558754 L69.6571005,-29.6511573 C68.2079177,-31.1013613 66.2051847,-32 63.9929031,-32 L32.0070969,-32 C27.5881712,-32 24,-28.418278 24,-24 C24,-19.5907123 27.5848994,-16 32.0070969,-16 L56,-16 L56,7.99290312 C56,10.2035488 56.8963895,12.2062834 58.3454713,13.655876 L58.3429,13.6511579 C59.7920828,15.1013615 61.7948156,16 64.0070969,16 L88,16 L88,39.9929031 C88,44.4118288 91.581722,48 96,48 C100.409288,48 104,44.4151006 104,39.9929031 L104,8.00709688 C104,5.79645151 103.103611,3.79371715 101.654529,2.34412458 Z" id="Rectangle-440-Copy" transform="translate(64.000000, 8.000000) scale(1, -1) rotate(-45.000000) translate(-64.000000, -8.000000) "></path>
</g>
</svg>

View File

@ -32,6 +32,8 @@ ExportTiddlers/Caption: export tiddlers
ExportTiddlers/Hint: Export tiddlers
Fold/Caption: fold/unfold tiddler
Fold/Hint: Fold/unfold the body of this tiddler
FoldOthers/Caption: fold other tiddlers
FoldOthers/Hint: Fold the bodies of other opened tiddlers
FullScreen/Caption: full-screen
FullScreen/Hint: Enter or leave full-screen mode
Help/Caption: help

View File

@ -30,7 +30,8 @@ var NavigatorWidget = function(parseTreeNode,options) {
{type: "tm-new-tiddler", handler: "handleNewTiddlerEvent"},
{type: "tm-import-tiddlers", handler: "handleImportTiddlersEvent"},
{type: "tm-perform-import", handler: "handlePerformImportEvent"},
{type: "tm-fold-tiddler", handler: "handleFoldTiddlerEvent"}
{type: "tm-fold-tiddler", handler: "handleFoldTiddlerEvent"},
{type: "tm-fold-other-tiddlers", handler: "handleFoldOtherTiddlersEvent"}
]);
};
@ -579,6 +580,16 @@ NavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) {
}
};
NavigatorWidget.prototype.handleFoldOtherTiddlersEvent = function(event) {
var self = this,
paramObject = event.paramObject || {},
prefix = paramObject.foldedStatePrefix;
$tw.utils.each(this.getStoryList(),function(title) {
var foldedState = self.wiki.getTiddlerText(prefix + title,"show");
self.wiki.setText(prefix + title,"text",null,event.param === title ? foldedState : "hide");
});
};
exports.navigator = NavigatorWidget;
})();

View File

@ -0,0 +1,14 @@
title: $:/core/ui/Buttons/fold-others
tags: $:/tags/ViewToolbar
caption: {{$:/core/images/fold-others-button}} {{$:/language/Buttons/FoldOthers/Caption}}
description: {{$:/language/Buttons/FoldOthers/Hint}}
<$button tooltip={{$:/language/Buttons/FoldOthers/Hint}} aria-label={{$:/language/Buttons/FoldOthers/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-fold-other-tiddlers" $param=<<currentTiddler>> foldedStatePrefix="$:/state/folded/"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]" variable="listItem">
{{$:/core/images/fold-others-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/FoldOthers/Caption}}/></span>
</$list>
</$button>