mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Add fold tiddler toolbar button
Addressing this tweet: https://twitter.com/s_stryjecki/status/629349768280604672
This commit is contained in:
parent
6a3c4d6c91
commit
5d43cd7408
9
core/images/fold-button.tid
Normal file
9
core/images/fold-button.tid
Normal file
@ -0,0 +1,9 @@
|
||||
title: $:/core/images/fold-button
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-fold tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<rect x="0" y="0" width="128" height="16" rx="8"></rect>
|
||||
<path d="M40,118 L40,62.0000511 C40,57.5797863 36.418278,54 32,54 C27.5907123,54 24,57.5817449 24,62.0000511 L24,125.999949 C24,130.409288 27.5817449,134 32.0000511,134 L95.9999489,134 C100.420214,134 104,130.418278 104,126 C104,121.590712 100.418255,118 95.9999489,118 L40,118 Z" id="Rectangle-432-Copy" transform="translate(64.000000, 94.000000) scale(1, -1) rotate(-45.000000) translate(-64.000000, -94.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
9
core/images/unfold-button.tid
Normal file
9
core/images/unfold-button.tid
Normal file
@ -0,0 +1,9 @@
|
||||
title: $:/core/images/unfold-button
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-unfold tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<rect x="0" y="0" width="128" height="16" rx="8"></rect>
|
||||
<path d="M40,73 L40,17.0000511 C40,12.5797863 36.418278,9 32,9 C27.5907123,9 24,12.5817449 24,17.0000511 L24,80.9999489 C24,85.4092877 27.5817449,89 32.0000511,89 L95.9999489,89 C100.420214,89 104,85.418278 104,81 C104,76.5907123 100.418255,73 95.9999489,73 L40,73 Z" transform="translate(64.000000, 49.000000) rotate(-45.000000) translate(-64.000000, -49.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
@ -30,6 +30,8 @@ ExportTiddler/Caption: export tiddler
|
||||
ExportTiddler/Hint: Export tiddler
|
||||
ExportTiddlers/Caption: export tiddlers
|
||||
ExportTiddlers/Hint: Export tiddlers
|
||||
Fold/Caption: fold/unfold tiddler
|
||||
Fold/Hint: Fold/unfold the body of this tiddler
|
||||
FullScreen/Caption: full-screen
|
||||
FullScreen/Hint: Enter or leave full-screen mode
|
||||
Help/Caption: help
|
||||
|
@ -29,7 +29,8 @@ var NavigatorWidget = function(parseTreeNode,options) {
|
||||
{type: "tm-close-other-tiddlers", handler: "handleCloseOtherTiddlersEvent"},
|
||||
{type: "tm-new-tiddler", handler: "handleNewTiddlerEvent"},
|
||||
{type: "tm-import-tiddlers", handler: "handleImportTiddlersEvent"},
|
||||
{type: "tm-perform-import", handler: "handlePerformImportEvent"}
|
||||
{type: "tm-perform-import", handler: "handlePerformImportEvent"},
|
||||
{type: "tm-fold-tiddler", handler: "handleFoldTiddlerEvent"}
|
||||
]);
|
||||
};
|
||||
|
||||
@ -569,6 +570,15 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
|
||||
$tw.rootWidget.dispatchEvent({type: "tm-auto-save-wiki"});
|
||||
};
|
||||
|
||||
NavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) {
|
||||
var self = this,
|
||||
paramObject = event.paramObject || {};
|
||||
if(paramObject.foldedState) {
|
||||
var foldedState = this.wiki.getTiddlerText(paramObject.foldedState,"show") === "show" ? "hide" : "show";
|
||||
this.wiki.setText(paramObject.foldedState,"text",null,foldedState);
|
||||
}
|
||||
};
|
||||
|
||||
exports.navigator = NavigatorWidget;
|
||||
|
||||
})();
|
||||
|
@ -5,7 +5,7 @@ tags: $:/tags/PageTemplate
|
||||
|
||||
<div class="tc-sidebar-header">
|
||||
|
||||
<$reveal state="$:/state/sidebar" type="match" text="yes" default="yes" retain="yes">
|
||||
<$reveal state="$:/state/sidebar" type="match" text="yes" default="yes" retain="yes" animate="yes">
|
||||
|
||||
<h1 class="tc-site-title">
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
title: $:/core/ui/ViewTemplate/body
|
||||
tags: $:/tags/ViewTemplate
|
||||
|
||||
\define folded-state()
|
||||
$:/state/folded/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
<div class="tc-tiddler-body">
|
||||
|
||||
<$reveal type="nomatch" state=<<folded-state>> text="hide" retain="yes" animate="yes">
|
||||
|
||||
<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">
|
||||
|
||||
<$transclude>
|
||||
@ -13,4 +19,6 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
</$list>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</div>
|
||||
|
@ -1,8 +1,14 @@
|
||||
title: $:/core/ui/ViewTemplate/subtitle
|
||||
tags: $:/tags/ViewTemplate
|
||||
|
||||
\define folded-state()
|
||||
$:/state/folded/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
<$reveal type="nomatch" state=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-subtitle">
|
||||
<$link to={{!!modifier}}>
|
||||
<$view field="modifier"/>
|
||||
</$link> <$view field="modified" format="relativedate"/>
|
||||
</div>
|
||||
</$reveal>
|
||||
|
@ -1,4 +1,10 @@
|
||||
title: $:/core/ui/ViewTemplate/tags
|
||||
tags: $:/tags/ViewTemplate
|
||||
|
||||
\define folded-state()
|
||||
$:/state/folded/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
<$reveal type="nomatch" state=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
</$reveal>
|
23
core/ui/ViewToolbar/fold.tid
Normal file
23
core/ui/ViewToolbar/fold.tid
Normal file
@ -0,0 +1,23 @@
|
||||
title: $:/core/ui/Buttons/fold
|
||||
tags: $:/tags/ViewToolbar
|
||||
caption: {{$:/core/images/fold-button}} {{$:/language/Buttons/Fold/Caption}}
|
||||
description: {{$:/language/Buttons/Fold/Hint}}
|
||||
|
||||
\define folded-state()
|
||||
$:/state/folded/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
<$button tooltip={{$:/language/Buttons/Fold/Hint}} aria-label={{$:/language/Buttons/Fold/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-sendmessage $message="tm-fold-tiddler" $param=<<currentTiddler>> foldedState=<<folded-state>>/>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]" variable="listItem">
|
||||
<$reveal type="nomatch" state=<<folded-state>> text="hide" default="show">
|
||||
{{$:/core/images/fold-button}}
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<folded-state>> text="hide" default="show">
|
||||
{{$:/core/images/unfold-button}}
|
||||
</$reveal>
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
|
||||
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Fold/Caption}}/></span>
|
||||
</$list>
|
||||
</$button>
|
@ -1,2 +1,2 @@
|
||||
title: $:/tags/ViewToolbar
|
||||
list: [[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]]
|
||||
list: [[$:/core/ui/Buttons/fold]] [[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]]
|
||||
|
@ -620,7 +620,7 @@ button.tc-untagged-label {
|
||||
z-index: 1000;
|
||||
background-color: <<colour page-background>>;
|
||||
width: 100%;
|
||||
max-height: 50%;
|
||||
max-height: 100%;
|
||||
<<if-no-sidebar "
|
||||
width: auto;
|
||||
max-height: auto;
|
||||
|
Loading…
Reference in New Issue
Block a user