TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.07k stars 1.19k forks source link

Feature req: Drag'n drop transclusion #2563

Open twMat opened 8 years ago

twMat commented 8 years ago

Drag'n dropping a title link, e.g from sidebar list, into an editor adds the title there like [[Foo bar]]. Very nice.

I would like to be able to get it added as {{Foo bar}}, as an option. Perhaps by holding down a key during the dragging.

This would make reuse of tiddlers even simpler and seems to me like a shortcut for drag'n drop functionality (...or I'm just ignorant of how complex it would be to add {{ around the title...).

tobibeer commented 8 years ago

Can you describe an actual scenario when you would (want to) use this? ...as in "And this would be my workflow: ..."?

twMat commented 8 years ago

Sure. Or at least a merge of workflow description and examples:

1) The simplest example is that one is authoring a tiddler and want's it to transclude another tiddler. Say you're authoring a "member presentation", and you want to drag in member profiles so they show up, rather than just their tiddler names. As you edit the encompassing tiddler, you in the search box type in (the prefix) "Member" and then drag in the desired names... i.e with surrounding transclusions. Currently when you do this, you get the tiddler links.

2) More fun example: A sidebar "toolbox" of items needing no parameter or only needing implicit currentTiddler as parameter. A simple example is a gallery of images. Workflow;

I'm authoring a tiddler in edit mode. Sidebar tab is showing a listing of images (their titles, perhaps with thumbnail). I "trans-drag" the desired image into my text and continue happily.

(Such a toolbox gallery is desirable for my own use In my fiddling I quite often need core images but their difficult-to-remember names actually makes me go to a thing you've made!)

3) Another gallery example; In a social network (yes, twederation) one could imagine an avatar showing up instead of using @bob, i.e drag in the avatar from a "contacts list" or a "current participants list" into the edit-text when addressing someone. Such an avatar, i.e the contents of that tiddler, could be a reveal button showing only the avatar by default but if clicked it expands to show relevant stuff. Note that the tiddler is transcluded into the current one so it can show context specific stuff.

4) In sidebar I have a listing of buttons (e.g titled //teacher//, //student//, //classroom//, //subject// ...) that, when clicked, reveals a list of //tiddler field names// specific for tiddlers in that category. Say I'm creating a //table// that should display a selection of those fields. Instead of having to have the field names memorized or go look for them, I have them listed and can trans-drag them into my table code.

tobibeer commented 8 years ago

Ok, so what I get from your examples is that it's not necessarily the tiddler content that you want to transclude. So, I would imagine something where, by default, your keyboard modifier would trigger transclusion, ok, but where I can also specify a list of criteria in config tiddlers defined as pairs of:

  1. filter: when the tiddler being dragged matches this filter, then the below drop-pattern is applied
  2. drop: a bit of markup, e.g. a definition of the content to be dropped for the tiddler matching the filter

The default could be:

twMat commented 8 years ago

Heh, yes that is really one up! The current drag'n drop to get a title link is neat but we should probably treat it like a special case of what could potentially appear/happen as one drops.

That said, I fear that complexifying the OP risks making it all a pipe dream. An assumption of mine is that it would be simple to merely exchange the square brackets for curly brackets (...right?) so, given my own hacking limitations, I'm hesitant to expand the idea at this point.

danielo515 commented 8 years ago

Hey, let's add drag and drop tagging to the mix!

saqimtiaz commented 3 years ago

Just a bit of clarification here:

Dragging and dropping a link/button on to the editor inserts a title list containing the tiddlers that are the payload for that element.

In a title list any titles with spaces are enclosed in double brackets. Titles without spaces are therefore inserted without brackets. There is no specific behaviour to insert a link, it just happens that a title in double brackets is the correct syntax for a link.