Patch to allow "close all" toolbar button

3 views
Skip to first unread message

Derek Peschel

unread,
Oct 19, 2009, 8:15:44 PM10/19/09
to TiddlyWikiDev
This patch creates a closeAll command, which can go in tiddler
toolbars, as a companion to the closeAll macro, which can only go in
the sidebar.

--- Config.js.orig.20091019a 2009-10-18 14:37:46.000000000 -0700
+++ Config.js 2009-10-19 16:10:23.000000000 -0700
@@ -136,6 +136,7 @@
config.commands = {
closeTiddler: {},
closeOthers: {},
+ closeAll: {},
editTiddler: {},
saveTiddler: {hideReadOnly: true},
cancelTiddler: {},
--- Lingo.js.orig.20091019a 2009-10-19 16:05:36.000000000 -0700
+++ Lingo.js 2009-10-19 16:16:04.000000000 -0700
@@ -374,6 +374,10 @@
text: "close others",
tooltip: "Close all other tiddlers"});

+merge(config.commands.closeAll,{
+ text: "close all",
+ tooltip: "Close all displayed tiddlers (except any that are being
edited)"});
+
merge(config.commands.editTiddler,{
text: "edit",
tooltip: "Edit this tiddler",
--- Commands.js.orig.20091019a 2009-10-18 14:37:46.000000000 -0700
+++ Commands.js 2009-10-19 16:13:28.000000000 -0700
@@ -19,6 +19,12 @@
return false;
};

+config.commands.closeAll.handler = function(event,src,title)
+{
+ story.closeAllTiddlers();
+ return false;
+};
+
config.commands.editTiddler.handler = function(event,src,title)
{
clearMessage();

Eric Shulman

unread,
Oct 20, 2009, 4:37:22 AM10/20/09
to TiddlyWikiDev
> This patch creates a closeAll command, which can go in tiddler
> toolbars, as a companion to the closeAll macro, which can only go in
> the sidebar.

<<closeAll>> *can* be displayed as a toolbar command simply by
embedding the following syntax in the ViewTemplate:
<span class='toolbar' macro='closeAll'></span>

-e

FND

unread,
Oct 20, 2009, 4:45:16 AM10/20/09
to tiddly...@googlegroups.com
>> This patch creates a closeAll command, which can go in tiddler
>> toolbars, as a companion to the closeAll macro
>
> <<closeAll>> *can* be displayed as a toolbar command

FWIW, we're hoping that at some point we can unify macros and commands,
given that they're very similar in nature.
No immediate plans so far though.


-- F.

Derek Peschel

unread,
Oct 20, 2009, 4:51:30 PM10/20/09
to TiddlyWikiDev
On Oct 20, 1:37 am, Eric Shulman <elsdes...@gmail.com> wrote:
> <<closeAll>> *can* be displayed as a toolbar command simply by
> embedding the following syntax in the ViewTemplate:
>    <span class='toolbar' macro='closeAll'></span>

Interesting. TiddlyWiki undoubtedly has many tricks like that, which
I'm still learning. Do people use this technique? With which macros?

As you point out in another thread, if macros have accessKeys then
duplicating them may lead to undefined browser behavior. Commands,
on the other hand, are designed to be duplicated.

-- Derek
Reply all
Reply to author
Forward
0 new messages