How to enable/disable a plugin (with save/reload) via a button

120 views
Skip to first unread message

Ton Gerner

unread,
Aug 1, 2016, 11:58:47 AM8/1/16
to TiddlyWiki
Hi all,

Use case:
I want to make a button in my top toolbar which toggles a plugin on/off. Therefore it is needed to save and refresh the wiki afterwards to make the toggling effective.

1) With the following code I can toggle the plugin on/off:

<$reveal state="$:/config/Plugins/Disabled/$:/plugins/tongerner/xyz" type="nomatch" text="no">
<$button set="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" setTo="no" tooltip="" aria-label="" class="tc-btn-invisible">{{Arrow_A}}
</$button>
</$reveal>
<$reveal state="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" type="match" text="no">
<$button set="$:/config/Plugins/Disabled/$:/plugins/tongerner/xyz" setTo="yes" tooltip="" aria-label="" class="tc-btn-invisible">{{Arrow_B}}
</$button>
</$reveal>

2) With the following code I can save and refresh the wiki:

<$button>
<$action-sendmessage $message="tm-home"/>
<$action-sendmessage $message="tm-full-screen"/>
Save & refresh!
</$button>

or - with a macro:

\define my-actions()
<$action-sendmessage $message="tm-save-wiki"/>
<$action-sendmessage $message="tm-browser-refresh"/>
\end

<$button actions=<<my-actions>>>
Save & refresh!
</$button>

My problem is how to combine both parts 1) and 2).
A construction like:

<$button><$action-sendmessage $message="tm-home"/> set="....

or

<$button actions=<<my-actions>>> set="....

does not work.

Any help appreciated.

Cheers,

Ton


Ton Gerner

unread,
Aug 3, 2016, 5:44:19 AM8/3/16
to TiddlyWiki
Hi all,

Hmm, nobody any idea?

I made a Minimal Test Case
Hope that helps.

Cheers,

Ton


Josiah

unread,
Aug 3, 2016, 7:42:30 AM8/3/16
to TiddlyWiki
i have NO idea.

what I do see is that given the centrality of plugins to TW function they deserve more attention  in how they function.

at the moment in some ways they are a bit of a mess.

suggestions ...

1 - YOURS. Toggle ability from toolbar for any you select.

2 - Mechanism to BUNDLE them for easier transport.

3 - A DELETE option in the plugins list.

Best wishes
Josiah

Birthe C

unread,
Aug 3, 2016, 6:51:23 PM8/3/16
to TiddlyWiki
Hi Ton,

I tried to combine your buttons and it seemed to work:

\define my-actions()
<$action-sendmessage $message="tm-save-wiki"/>
<$action-sendmessage $message="tm-browser-refresh"/>
\end

<$reveal state="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" type="nomatch" text="no">
<$button set="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" setTo="no" actions=<<my-actions>>>Enable toolbar and save/refresh
</$button>
</
$reveal>
<$reveal state="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" type="match" text="no">
<$button set="$:/config/Plugins/Disabled/$:/plugins/tongerner/toolbar" setTo="yes" actions=<<my-actions>>>Disable toolbar and save/refresh
</$button>
</
$reveal>



Birthe

Danielo Rodríguez

unread,
Aug 4, 2016, 3:43:05 AM8/4/16
to TiddlyWiki
>>>>
suggestions ...

1 - YOURS. Toggle ability from toolbar for any you select.

2 - Mechanism to BUNDLE them for easier transport.

3 - A DELETE option in the plugins list.

<<<<<

Hello Josiah,

I agree with you, Un fact I have opened am issue about that same topic 2 years ago. Please, could you share your suggestions there too? So I don't look like a crazy old man?
https://github.com/Jermolene/TiddlyWiki5/issues/645

Ton Gerner

unread,
Aug 4, 2016, 5:18:33 AM8/4/16
to TiddlyWiki
Hi Birthe,


On Thursday, August 4, 2016 at 12:51:23 AM UTC+2, Birthe C wrote:
Hi Ton,

I tried to combine your buttons and it seemed to work:

Yes, it really works. Big thanks to you.
Everything I tried ended up with errors; for sure my fault ;-)

Thanks again

Ton
 
Reply all
Reply to author
Forward
0 new messages