Add fold tiddler toolbar button

Addressing this tweet:
https://twitter.com/s_stryjecki/status/629349768280604672
This commit is contained in:
Jermolene
2015-08-09 11:10:04 +01:00
parent 6a3c4d6c91
commit 5d43cd7408
11 changed files with 77 additions and 4 deletions
+11 -1
View File
@@ -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;
})();