What would be the best way to allow each tiddler, or part there of to be a custom drop zone?

Folks,

I am wondering What would be the best way to allow each tiddler, or part there of, to be a custom drop zone?.

Basically when we drop tiddler title, links or other content on a tiddlywiki it invokes the import mechaisium. It would be useful if we could customise various tiddlers so they act as drop zones to treat such drops differently.

Examples

  • I would like to open a tiddler add drop links on it, rather than invoke the import mechaisium if what is being dropped begins “http” could be added as a field eg “link 1” “link 2” containing the URL. This would allow a specific tiddler to be used to collect relevant links. A separate view template would make the links available on that tiddler.
  • In another example I would like to drop text on a tiddler and have it appended to the text field.

I would be interested in creating a mechaisium for example where a tiddler containing a field “drop-actions” value “<<add-linkactions>>” the whole tiddler would become a drop zone where the “<<add-linkactions>>” macro responds to the dropping of content.

I would appreciate any ideas on how to achieve this.

Meaning other than the https://tiddlywiki.com/#DropzoneWidget or https://tiddlywiki.com/#DroppableWidget options? Just pointing out in case you haven’t exhausted these.

@stobot I expect the solution will use the widgets you point to. My question is how do I get the tiddler to be that “drop area”, and respond to a field containing the drop actions?

How would you do it?

Do we have to edit part of the page/story/viewTemplate mechanism’s or can we apply something to particular CSS class or ID?

Here is an example that works;

<$droppable actions={{!!drop-actions}}>
<$list filter="[tag[TableOfContents]]">

</$list>
</$droppable>

Notice how the inner list is used so an area exists in the current tiddler on which we can drop our “payload”.

All I need now is to determine how best to make the whole tiddler the drop zone.

eg;

All I need now is to determine how best to make the whole tiddler the drop zone.

Try this:

  1. Edit shadow tiddler $:/core/ui/ViewTemplate
  2. add \define drop-actions() {{!!drop-actions}} on a line after \whitespace trim
  3. add <$droppable actions=<<drop-actions>>> on a line before <$list filter=...>
  4. add </$droppable> on a line after </$list>

In the drop-actions FIELD, add whatever <$action-*> widgets you want. You can use <<actionTiddler>> to refer to the “payload” tiddler title and <<modifier>> to get the name of the modifier key, if any (one of: normal, ctrl, shift or ctrl-shift)

Note that the above change to the ViewTemplate includes all the tiddler elements (the title, tags, body, etc), but does NOT include the outer tc-tiddler-frame.

enjoy,
-e

2 Likes

Thanks Eric,

I followed your instructions but cloned $:/core/ui/ViewTemplate and changed the name in $:/config/ui/ViewTemplate

I will add a package with the result soon.