Dragable items in List Tab?

82 views
Skip to first unread message

amreus

unread,
Aug 5, 2021, 6:31:17 AM8/5/21
to TiddlyWiki

Good morning,

Is there some reason items in the List tab could not be made draggable for re-ordering? It seems like this would be a more accessible way to re-order toolbars, as an example.


  2021-08-05_062420.png

PMario

unread,
Aug 5, 2021, 7:18:53 AM8/5/21
to TiddlyWiki
Hi,

>Is there some reason items in the List tab could not be made draggable for re-ordering?

No. Nobody requested it yet ...

----------------------------

I think it should be easy to change the $:/core/ui/TiddlerInfo/List tiddler to contain a <<list-links-draggable>> macro.

... BUT ...

There is a problem. The existing code uses an emptyMessage=<<lingo List/Empty>>  ... to display some info if no "list" tiddler is present or the list is empty.

We will need to extend the <<list-links-draggable>> macro with an emptyMessage parameter, to create a backwards compatible function.

I'll create a github issue with your proposal.

-mario

PMario

unread,
Aug 5, 2021, 7:27:51 AM8/5/21
to TiddlyWiki

TW Tones

unread,
Aug 5, 2021, 8:55:52 PM8/5/21
to TiddlyWiki
amreus,

The tabs are effectively a list of buttons anyway. It would perhaps be easier to build your own tab macro with the extended features on each button.

Alternatively you could have a tab in which you list the tab titles with the draggable macro in which you can drag and drop the order.


Eg;
<<list-tagged-draggable tag:"$:/tags/SideBar">>

See attached on tiddlywiki.com

Regards
Tones
tab-order.json

Eric Shulman

unread,
Aug 5, 2021, 9:35:09 PM8/5/21
to TiddlyWiki
On Thursday, August 5, 2021 at 3:31:17 AM UTC-7 amreus wrote:
Is there some reason items in the List tab could not be made draggable for re-ordering?

This is actually quite easy to do, using the list-links-draggable macro

1) Edit the shadow tiddler: $:/core/ui/TiddlerInfo/List
2) Replace this line:
<$list filter="[list{!!title}]" emptyMessage=<<lingo List/Empty>> template="$:/core/ui/ListItemTemplate"/>
with this line:
<$macrocall $name="list-links-draggable" type="span" subtype="div" itemTemplate="$:/core/ui/ListItemTemplate"/>

That's it.  After doing the above, the contents of each tiddler's Info>List tab will now be draggable.

Note:
By default, the list-links-draggable macro displays its output as a bullet list.
By using type="span" and subtype="div", the bullets are suppressed
and the output is just a simple list of links, one per line.

enjoy,
-e

Eric Shulman

unread,
Aug 5, 2021, 9:43:31 PM8/5/21
to TiddlyWiki
On Thursday, August 5, 2021 at 5:55:52 PM UTC-7 TW Tones wrote:
The tabs are effectively a list of buttons anyway. It would perhaps be easier to build your own tab macro with the extended features on each button.
Alternatively you could have a tab in which you list the tab titles with the draggable macro in which you can drag and drop the order.

Amreus' request is to be able to drag "items in the List tab", not to drag the tabs themselves.

This is actually very easy to do, using the list-links-draggable macro.  See my solution posted separately

-e

Eric Shulman

unread,
Aug 5, 2021, 9:53:51 PM8/5/21
to TiddlyWiki
On Thursday, August 5, 2021 at 6:35:09 PM UTC-7 Eric Shulman wrote:
This is actually quite easy to do, using the list-links-draggable macro

errata: my previous solution omitted the display of the "List/Empty" message when the list field is empty.

Here's a corrected version that includes the "List/Empty" message:
<$list filter="[list{!!title}limit[1]]" emptyMessage=<<lingo List/Empty>> variable="has_list_items">
   <$macrocall $name="list-links-draggable" type="span" subtype="div" itemTemplate="$:/core/ui/ListItemTemplate"/>
</$list>

Note:
* The outer $list widget checks to see if the list field has at least 1 item. If it doesn't, the fallback emptyMessage content is displayed.
* Using variable="has_list_items" preserves the currentTiddler context for use by the $macrocall contained within the $list widget.

-e

amreus

unread,
Aug 7, 2021, 11:00:39 AM8/7/21
to TiddlyWiki
Thanks for the replies.  I ended up with something very close to Eric first example except I added a separate ListEdit tab in the Info area.  If you read the Github discussion, Jeremy seems to like the idea so perhaps it'll be a feature soon.

Thanks.
Reply all
Reply to author
Forward
0 new messages