Folks,

I am working on a way to add custom actions to any button in the core and 
that you create. 
I want this to result in the smallest change possible to see if it is 
worthy of core inclusion or plugin.
I have also designed an approach to make this reusable, and set some 
standards.

This post is not for the faint hearted but those keen to extend tiddlywiki, 
set new standards, new users please don't bother with it. I will share any 
results. 
*If you have any suggestions for a better way for me to communicate such 
ideas please let me know.*

I have come up with a strategy and I want to call for your comments

   - Each new or existing button will have the actions=actionreference 
   specify a template tiddler. 
   - The template tiddler will then respond to a "tag name" if it exists 
   and transclude all tiddlers so tagged into the actions= parameter.
   - Thus it it will be easy to add additional actions to any button by 
   placing them in a tiddler so tagged.

*Why would I do this?*

Because tiddlywiki needs a trigger for a range of actions. Buttons allow 
this but we often have to make a button to just to cause an action to take 
place. 
This often demands an additional step by the user when often the standard 
buttons provide the ideal opportunity already. For example I could trigger 
an action on closing a tiddler, on saving the wiki, on importing something 
to mention a few.

*Why a request for comments?*

I want the following concepts considered, perhaps to set de facto or de 
jure standards. 

   - This solution includes two concepts, one is the concept of actions in 
   "action tiddlers" that would become part of the core to support hackability 
   of core buttons ;
      - We may as well also have a generalised form for other transclusions 
      by tagname 
   - A concept called autotags, where by a tagname is defined and used only 
   if a tiddler exists with that tagname.

For example $:/core/ui/Buttons/edit would have the following actions 
parameter `actions={{edit||$:/actions}} `.

*My Current Strategy is to *

   - create a tiddler called $:/actions which is transcluded as follows 
   `actions={{actioname||$:/actions}}` as needed. 
   - This template could then transclude a tiddler (if it exists called 
   $:/actions/actioname) but first let us consider autotags.
   - You can have more than one action name in one button tiddler eg 
   `actions={{fold||$:/actions}} and actions={{unfold||$:/actions}}`

Autotags: because multiple designers/developers may wish to add additional 
actions and not impact other macros and plugins using extended actions for 
the core buttons, I want to add another feature called autotags.

   - The $:/actions template can assume a tag name from the actioname such 
   that as for the above edit example it would be $:/actions/edit
   - Any tiddler tagged $:/actions/edit will be transcluded into the 
   actions parameter of the edit button, 
   - the actual tiddler  $:/actions/edit need not exist, although I would 
   create one with an explanation for each core button. see 
   [prefix[$:/core/ui/buttons]] and others such as $:/core/ui/EditorToolbar 
   and more.

It is useful to have tags of the form `{{actioname||$:/actions}}` because 
they must contain actions however we could provide a generic transclude 
solution as well.

   - create a tiddler called $:/transclusions which is transcluded as 
   follows `actions={{transclusionname||$:/transclusions}}` as needed. 
   - The $:/transclusions template can assume a tag name from the 
   $:/transclusionsname such that for example it would be 
   $:/transclusions/transclusionsname 
   - Any tiddler tagged $:/transclusions/transclusionsname will be 
   transcluded where `{{transclusionname||$:/transclusions}}` is used, 
   - for example the tag $:/transclusions/chapter in 
   {{chapter||$:/transclusions}}

*In closing*

A key advantage of taking this approach is we can share actions or 
transclusions freely without requiring more than a tiddler and a template 
transclusion in our own code.

The order of actions can be set in the tagpill (list field) of each 
tagname, and use list-before and list-after fields.

The autotag concept can be extended further.

NB: I am aware of some work by Jeremy 
Allow message handlers to be written as action strings #4265 
<https://github.com/Jermolene/TiddlyWiki5/issues/4265> that need to 
"understand each other".
See my own issue Hackability of default triggers - "Buttons" #4272 
<https://github.com/Jermolene/TiddlyWiki5/issues/4272>

Regards
Tony

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/362c7775-787d-4e73-b618-571c1e2eb06d%40googlegroups.com.

Reply via email to