On Friday, January 24, 2020 at 8:34:46 PM UTC-8, Mohammad wrote:
>
> In the example of previous post assume you add a new tiddler tagged with A 
> named ad
> If *ad* has a list-after field with value *aa*, whenever you reorder list 
> and darg and drop *aa* to a new position, dd will be moved and appear 
> after *aa*.
> the same is true for child tiddlers with list-before field.
>

I think both of these issues (the missing/empty list, and the use of 
list-before/list-after) need additional code in the drop handler to force 
the desired result.  Something similar to what is done in the 
$:/core/macros/list drop handler, where it gets the current order of the 
tagged items (even if there is no list field), clears all 
list-before/list-after fields, and then builds an appropriate list field in 
the target tag:

\define list-tagged-draggable-drop-actions(tag)
<!-- Save the current ordering of the tiddlers with this tag -->
<$set name="order" filter="[<__tag__>tagging[]]">
<!-- Remove any list-after or list-before fields from the tiddlers with this 
tag -->
<$list filter="[<__tag__>tagging[]]">
<$action-deletefield $field="list-before"/>
<$action-deletefield $field="list-after"/>
</$list>
<!-- Save the new order to the Tag Tiddler -->
<$action-listops $tiddler=<<__tag__>> $field="list" 
$filter="+[enlist<order>] +[insertbefore:currentTiddler<actionTiddler>]"/>
<!-- Make sure the newly added item has the right tag -->
<!-- Removing this line makes dragging tags within the dropdown work as 
intended -->
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
<!-- Using the following 5 lines as replacement makes dragging titles from 
outside into the dropdown apply the tag -->
<$list filter="[<actionTiddler>!contains:tags<__tag__>]">
<$fieldmangler tiddler=<<actionTiddler>>>
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
</$fieldmangler>
</$list>
</$set>
\end

I'll work on it over the next few days...

-e

-- 
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/5c922b33-b0cb-465d-8245-663962eebd93%40googlegroups.com.

Reply via email to