TiddlyWiki5 icon indicating copy to clipboard operation
TiddlyWiki5 copied to clipboard

[IDEA] add drag-and-drop handling to the $:/AdvancedSearch Filter "export" button

Open ericshulman opened this issue 1 year ago • 9 comments

Sometimes I want to export/import a bunch of tiddlers from one TiddlyWiki to another, using the $:/AdvancedSearch > Filter tab, but I don't want to download a JSON file and then drag it to the other TiddlyWiki.

Instead, I just want to drag-and-drop all the matching titles into the other TiddlyWiki.

This can be easily done by making a VERY small change in $:/core/macros/export:

Change this: <$button popup=<<qualify "$:/state/popup/export">> tooltip=<<hint>> aria-label=<<caption>> class=<<tv-config-toolbar-class>> selectedClass="tc-selected"> to <$button popup=<<qualify "$:/state/popup/export">> tooltip=<<hint>> aria-label=<<caption>> class=<<tv-config-toolbar-class>> selectedClass="tc-selected" dragFilter=<<__exportFilter__>>>

(i.e., adding dragFilter=<<__exportFilter__>> to the $button.

With this small change, the export button can now be dragged directly onto another TiddlyWiki to initiate an interactive $:/Import of all the matched tiddlers.

I already have this functionality in the "export" button in https://tiddlytools.com/#TiddlyTools%2FSearch%2FFilters, but it would be convenient if this was also a core usability feature enhancement, so that the same drag-and-drop handling is available from ANY TiddlyWiki, without needing to use my custom search.

ericshulman avatar Aug 08 '24 14:08 ericshulman

I can't count how many times I searched this functionality in TW's default UI. And the fix is so simple!

Thanks @ericshulman for opening this topic!

tw-FRed avatar Aug 08 '24 17:08 tw-FRed

PR! PR! PR! ... c'mon everybody: PR! PR! PR!

twMat avatar Aug 08 '24 17:08 twMat

Did I understand correctly, Erics example, is that one drags and drops the > symbol?

I as I wrote here https://talk.tiddlywiki.org/t/astounding-ux-enhancement-and-proposal-from-eric/10371/5?u=tw_tones I have had a solution for this in the past where a more direct export to JSON button is presented, which can be dragged and dropped to another wiki.

  • If installing a bundle or plugin is insufficient to use this and we want it in the core, there is more we can do at the same time.
    • Allow selection of the shortcut export or drag and drop icons (in my implementation) for each relevant export type (config settings to show/hide) each of which can be dragged as well)
    • Add additional export tryps such as;
      • Bookmarklets
      • The new compound tiddler format
      • others...

To test it see https://bookmarklets.tiddlyhost.com/ and advanced search > Filter, the first icon is a JSON that can be dragged elsewhere. If clicked it does the equivalent of Export > JSON (with one click)

AnthonyMuscio avatar Aug 08 '24 23:08 AnthonyMuscio

Did I understand correctly, Erics example, is that one drags and drops the > symbol?

There is no ">" symbol in the $:/AdvancedSearch Filters tab. There IS, however, a down-arrow symbol, which you can use to select a previous saved filter... but this is NOT what I was referring to. Rather, once you've entered (or selected) a filter into the search input, several additional buttons appear. Among those buttons is an "export" button ("out-box" with upward pointing arrow). Normally, when you click this button you get a drop-down to select an export format (CSV, JSON, Static HTML, or TID text file).

What I am proposing is to add a dragFilter=<<__exportFilter__>> param to that export button, so that if you drag the button instead of clicking it, you can drop it directly on another open TiddlyWiki window to initiate an $:/Import of the entire set of tiddlers that match the filter you have entered.

I as I wrote here https://talk.tiddlywiki.org/t/astounding-ux-enhancement-and-proposal-from-eric/10371/5?u=tw_tones I have had a solution for this in the past where a more direct export to JSON button is presented, which can be dragged and dropped to another wiki.

My proposal does not add an extra button; it just adds extra functionality to the existing "export" button.

  • If installing a bundle or plugin is insufficient to use this and we want it in the core, there is more we can do at the same time.

If you want to propose other enhancements, you should create a separate ticket, since those changes would be independent of my very minor proposed change to the existing "export" button, and should be discussed and considered separately.

ericshulman avatar Aug 09 '24 00:08 ericshulman

This is what I saw, when I made the change, possibly in error; Snag_450547f

Now corrected, its the Export Icon that is the one we can drag and drop.

I support this idea as it is inconspicuous and useful but perhaps the tooltip message could also change?

However I think further improvements could come along soon as mentioned in the talk thread

AnthonyMuscio avatar Aug 09 '24 03:08 AnthonyMuscio

PR! PR! PR! ... c'mon everybody: PR! PR! PR!

It's nice to be enthusiastic -- but --

It's not that simple. ... The current code is only readable by advanced users and changing it is error-prone as we can see.

  1. So the first step needs to be to make the code human readable
  2. Convert \define into \procedure
  3. Make sure that "old style" text substitution converted to "new style" in a backwards compatible way
  4. change $vars to $let
  5. Make sure everything works as before

So what seems to be a 1 minute change turns out to be "some real work"

And It needs to be documented. Otherwise it will be an ultra well hidden functionality.

It turns out that there is not too much info about How to export tiddlers. There is no info about the $:/AdvancedSearch UI at all. IMO at least the "Filter tab" could need some more general info.

pmario avatar Aug 09 '24 07:08 pmario

@Jermolene -- Do you think it should be implemented as suggested in the OP?

I personally support the proposal, with the addition, to implement and document it properly with "new style code" as described in my comment.

pmario avatar Aug 09 '24 07:08 pmario

If the tooltip indicated "drag and drop on another wiki" or similar, it would be at least finable.

However as illustrated in advanced search filter tab of https://bookmarklets.tiddlyhost.com/ and when there is a list of tiddlers just a little love could improve this quite a bit.

AnthonyMuscio avatar Aug 13 '24 01:08 AnthonyMuscio

Although we definitely should update the documentation and use "new style code", those should really be handled as separate tickets. That way each ticket represents a small isolated incremental change, with less potential for introducing unanticipated problems by combining them into a single task.

ericshulman avatar Aug 16 '24 02:08 ericshulman