I don't know what can be done with [the W3C DnD] example. It is essentially what tiddlywiki does now. The state has to be saved somewhere and tiddlywiki works with lists, so it uses lists for keeping track of drag and drop movements.
the reason that it is so simple in the example code is that it is all done in the dom because there is no persistent state, which isn't possible in tiddlywiki (it would lead to problems like when you have an edit-text widget edit the same tiddler it is in).
If you want to re-order the content of tiddlers by dragging and dropping them than that is possible to make happen, but the most tiddlywiki-like way to do that is to make a tiddler for each component you want to move around and then have the drag and drop part modify the order of that list, which as far as I understand it is what the drag and drop widget does.
To tiddlify that code you would say that each div is a tiddler and when you drag from one tiddler into another you move all of the content from one to the other, which I don't think is what you want because it is pretty much just renaming a tiddler. To use the natural ordering of things in a tiddler than you have to first define what those things are, otherwise how do you determine what gets picked up? [...]
[...] You have to define that somehow and then as soon as you define it you need to have a listing of the 'things' to be picked up somewhere. Which is why you end up with a list.
So, couldn't <div>this</div> sentence be a <div>list</div> with ten elements?
I applaud what you are trying to do. Perhaps there is another way to do this that would add even more value.
Here is a quick summary.
Provide a location at the bottom of every tiddler where you can drop a snipit. Such as the widgets you mention. Each time you drop such a snipit it is added as content in a field such as snipit-row-1 then snipit-row-2 etc... Perhaps you could replace line breaks with <br>
Now in a tiddler tagged view template transclude each of the fields beginning snipit-row in the order they apear. See MyMenus plugin as I do this for each menu-item
Now provide a way to alter the order of these fields even if they must be renamed.
Do you follow?
Tony
... DOM, which in tiddlywiki can be refreshed and recreated at any time. [...] This makes having the state saved manually by the user a bad solution because it may seemingly randomly lose work.
Most of the rest of the problem comes from how tiddlywiki has to know what you are trying to move, and what is a valid location for dropping it. If you can pick up individual words than how do you tell tiddlywiki you want to pick up the whole paragraph?
[...] 'drag any paragraph' ... you are going to have to lose some formatting and transclusions will break it because you are going from raw next -> wikitext -> html and then back from html->raw text. I am sure that is possible but I doubt it is easy to do in a way that preserves the specific markup in what you originally wrote.
Unless I am completely misunderstanding what you are asking for. If you want something like a button but you click and drag an item from one place and drop it in another and the resulting action is based on which starting and ending point is used than that is a different problem.
BUT, and this is very important I think, it wouldn't let you rearrange text any differently than you can rearrange plain text using existing wikitext widgets.
Maintain your vision and keep going. I see how you want control detail in the text field.
In my suggestion previously you can include text snipits between macro calls to have text throughout. In fact snipits can include;
Macro call functions
Custom text
Links and lists to other tiddlers
Transclusions of other tiddlers
References to the text and other fields in the current tiddler
With the approach you are taking it seems you will will have complex process ahead of you, perhaps the result will be worth it. However I cant help but feel there is a way to simplify.
Best of luck, I will share if I can help.
Tony
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$set name="curr" value=<<qualify "$:/tidbitz/scratch">> ><$tiddler tiddler=<<currentTiddler>>><$droppable actions="""<<TidBit-dropactions>>"""><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></div></$droppable></$tiddler></$set></$set></$set>
\define setScratchTiddlerField()
<$action-setfield $tiddler="""$(curr)$""" $field="tidbit-row-$(nextTidbitCount)$" $value="""your TidBit""/>
\end
\define TidBit-dropactions()
<$set name=TidBit filter="[[$(actionTiddler)$]removeprefix[TidBit/]]">
<$wikify name="id" text=<<TidBit-id>>>
<$wikify name="TidBitid" text=<<TidBitid>>>
<$list filter="[[$(actionTiddler)$/temp]fields[]prefix<TidBitid>!suffix[-id]]" variable="fld">
<<TidBit-setfields>>
</$list>
</$wikify>
<$set name="tidbitCount" filter="[[$(curr)$]fields[]prefix[tidbit-row]count[]]">
<$set name="nextTidbitCount" filter="[<tidbitCount>next[$:/list/numbers]]">
<<setScratchTiddlerField>>
</$set>
</$set>
</$wikify>
</$set>
\end\define renderTidbit()
$(tidbitContent)$
\end
\define getScratchFieldsContent()
<$list filter="[[$(curr)$]get[tidbit-row-$(tidbitRow)$]]" variable="tidbitContent">
<<renderTidbit>>
</$list>
\end
<$set name="tidbitCount" filter="[<curr>fields[]prefix[tidbit-row]count[]]">
<$list filter="[list[$:/list/numbers]limit<tidbitCount>]" variable="tidbitRow">
<<getScratchFieldsContent>>
</$list>
</$set>