diff --git a/core/images/fold-button.tid b/core/images/fold-button.tid new file mode 100644 index 000000000..833fbe880 --- /dev/null +++ b/core/images/fold-button.tid @@ -0,0 +1,9 @@ +title: $:/core/images/fold-button +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/images/unfold-button.tid b/core/images/unfold-button.tid new file mode 100644 index 000000000..f40c42785 --- /dev/null +++ b/core/images/unfold-button.tid @@ -0,0 +1,9 @@ +title: $:/core/images/unfold-button +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 2f3e88d29..e595d5610 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -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 diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index de57d9dff..bf0ef7d6b 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -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; })(); diff --git a/core/ui/PageTemplate/sidebar.tid b/core/ui/PageTemplate/sidebar.tid index f7166d5f5..f1bf4ecbc 100644 --- a/core/ui/PageTemplate/sidebar.tid +++ b/core/ui/PageTemplate/sidebar.tid @@ -5,7 +5,7 @@ tags: $:/tags/PageTemplate
-<$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">

diff --git a/core/ui/ViewTemplate/body.tid b/core/ui/ViewTemplate/body.tid index 74aae5d6f..d7467ebc9 100644 --- a/core/ui/ViewTemplate/body.tid +++ b/core/ui/ViewTemplate/body.tid @@ -1,8 +1,14 @@ title: $:/core/ui/ViewTemplate/body tags: $:/tags/ViewTemplate +\define folded-state() +$:/state/folded/$(currentTiddler)$ +\end +
+<$reveal type="nomatch" 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 + +
diff --git a/core/ui/ViewTemplate/subtitle.tid b/core/ui/ViewTemplate/subtitle.tid index c20588961..c1b646dde 100644 --- a/core/ui/ViewTemplate/subtitle.tid +++ b/core/ui/ViewTemplate/subtitle.tid @@ -1,8 +1,14 @@ title: $:/core/ui/ViewTemplate/subtitle tags: $:/tags/ViewTemplate +\define folded-state() +$:/state/folded/$(currentTiddler)$ +\end + +<$reveal type="nomatch" state=<> text="hide" tag="div" retain="yes" animate="yes">
<$link to={{!!modifier}}> <$view field="modifier"/> <$view field="modified" format="relativedate"/>
+ diff --git a/core/ui/ViewTemplate/tags.tid b/core/ui/ViewTemplate/tags.tid index 83157ad91..c385e7c7b 100644 --- a/core/ui/ViewTemplate/tags.tid +++ b/core/ui/ViewTemplate/tags.tid @@ -1,4 +1,10 @@ title: $:/core/ui/ViewTemplate/tags tags: $:/tags/ViewTemplate +\define folded-state() +$:/state/folded/$(currentTiddler)$ +\end + +<$reveal type="nomatch" state=<> text="hide" tag="div" retain="yes" animate="yes">
<$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/>
+ \ No newline at end of file diff --git a/core/ui/ViewToolbar/fold.tid b/core/ui/ViewToolbar/fold.tid new file mode 100644 index 000000000..a68e520a2 --- /dev/null +++ b/core/ui/ViewToolbar/fold.tid @@ -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=<>> +<$action-sendmessage $message="tm-fold-tiddler" $param=<> foldedState=<>/> +<$list filter="[prefix[yes]]" variable="listItem"> +<$reveal type="nomatch" state=<> text="hide" default="show"> +{{$:/core/images/fold-button}} + +<$reveal type="match" state=<> text="hide" default="show"> +{{$:/core/images/unfold-button}} + + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Fold/Caption}}/> + + \ No newline at end of file diff --git a/core/wiki/tags/ViewToolbar.tid b/core/wiki/tags/ViewToolbar.tid index 03173afc7..e23c026e7 100644 --- a/core/wiki/tags/ViewToolbar.tid +++ b/core/wiki/tags/ViewToolbar.tid @@ -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]] diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 83dd63a59..7acfecf84 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -620,7 +620,7 @@ button.tc-untagged-label { z-index: 1000; background-color: <>; width: 100%; - max-height: 50%; + max-height: 100%; <