TW5-PluginShowcase icon indicating copy to clipboard operation
TW5-PluginShowcase copied to clipboard

Added the possibility to trigger arbitrary actions from editor

Open rimi opened this issue 2 months ago • 5 comments

Needed this to effectively work with streams (https://saqimtiaz.github.io/streams/). Use it for years now, Maybe you can integrate into your main?

rimi avatar Oct 31 '25 14:10 rimi

Example-Usage:

image

----- According Tidler to reproduce -----

actions: <$action-setfield $tiddler=<<editedTiddler>> ro.type=<<currentTiddler>>/> auto-trigger-textarea: 1 caption: Set the ro.type created: 20251031133928951 display-filter: [<currentTiddler>] filter: [get[ro.type]unique[]search:title] modified: 20251031135207590 tags: $:/tags/EC/AutoComplete/Trigger template: $caret$ title: $:/EvidentlyCube/Trigger/2 trigger: :> type: text/vnd.tiddlywiki

rimi avatar Oct 31 '25 14:10 rimi

Can you add an example trigger with an action to the PR? Ideally something that most people would understand what it does and how it can be beneficial.

EvidentlyCube avatar Nov 16 '25 18:11 EvidentlyCube

Hey, thanks for reaching out!

I don't know how much you know about streams, but you are basically working in a "note-style" environment where you concentrate on typing text fast - every "bullet" is an own tiddler. but you are limited to edit the text-field of that tiddler you are currently working on. If you want to instantly create a task from a note you made (e.g. identified in your wiki by a tag "task") you have to leave that environment (e.g. by using the clumsy mouse-based approach going to the menu of the current note and clicking some entry). with your very nice plugin including my PR you can execute arbitrary(!) actions using your triggers. you ask for a somewhat simpler/more understandable example: the sample at the end let you set the "task"-tag to the current bullet-tiddler by just typing :t and pressing ENTER.

I hope that helps to get the point. Just to name a few more possibilities: fire events, update fields, import template-structures (subtrees) to the current streams-node, update states... a common, practical one for my "workflow" is to switch the type of a node to a graphviz-or railroad-type where i can instantly start "drawing" my ideas while i take notes.

This gives streams (or any other similar work-style) a whole new dimension (at least in my humble mind ;) )

Best regards, Mirko

actions: <$action-setfield $tiddler=<<editedTiddler>> tags="task"/>
auto-trigger-textarea: 1
caption: Add task-tag
created: 20251117083837776
display-filter: [<currentTiddler>]
filter: [[task]]
modified: 20251117084250340
tags: $:/tags/EC/AutoComplete/Trigger
template: $caret$
title: $:/EvidentlyCube/Trigger/3
trigger: :t
type: text/vnd.tiddlywiki

Adds the tag "task" to the current tiddler

rimi avatar Nov 17 '25 09:11 rimi

@rimi I know of Streams because early in the development of this plugin I had to change something because it wouldn't work together with it but I don't really use it :).

What I meant was less to do with what streams is but more about creating an example for the action functionality so that whoever looks at the plugin can understand how it works. If you'd rather me do the boring part of adding that I'm happy to oblige, just wanted to make sure you don't want to tackle it completely from your end... ...also I am not quite sure what the best way for me to add commits to your PR would be. I guess I could just merge it as-is and make the changes. Or make a branch, change the PRs target and merge it then :).

EvidentlyCube avatar Nov 17 '25 10:11 EvidentlyCube

I'm just happy, if it would be merged into your plugin (so i don't have to keep track of it over your releases). Nevertheless i'm also not sure if my PR suffices your code-quality-requirements (if i remember correctly i used $tw somewhere - not sure if you cold solve that better). So feel also free to create your very own commit and ignore that PR.

rimi avatar Nov 17 '25 12:11 rimi