It would be nice if drag and drop mechanism didn't happen everywhere

20 views
Skip to first unread message

Charlie Veniot

unread,
May 28, 2023, 11:56:37 AM5/28/23
to TiddlyWiki

Eric Shulman

unread,
May 28, 2023, 4:23:49 PM5/28/23
to TiddlyWiki
The `$dropzone` widget used to trigger drag-and-drop $:/Import handling is defined in `$:/core/ui/PageTemplate`:
```
<$dropzone enable=<<tv-enable-drag-and-drop>>>
```
which also defines the `tv-enable-drag-and-drop` variable, which gets it's value from the contents of `$:/config/DragAndDrop/Enable`, and has a default value of "yes".  To disable the default $dropzone, create a tiddler named `$:/config/DragAndDrop/Enable`, with a text field value of "no".  After doing this, you will no longer be able to use drag-and-drop to import tiddlers.  You will still be able to use the "Import" PageToolbar button (see the sidebar "Tools" tab, or `$:/ControlPanel > Appearance > Toolbars > Page Toolbar` settings) to initiate a "browse for file" system dialog to import tiddlers from locally saved .JSON files.

You can define your own custom dropzone "hotspot" by creating a tiddler containing something like `<$dropzone>drop here to import tiddlers</$dropzone>`.  When that tiddler is displayed, you can then drag-and-drop onto the "drop here to import tiddlers" text to initiate the TWCore's usual $:/Import handling.  To add a nice visible "import tiddlers" $button interface into the SideBar, try this:
* Create a tiddler (e.g., SidebarImportZone)
* Enter text content: `<$dropzone><$button>drop here to import tiddlers</$button></$dropzone>`
* Tag it with `$:/tags/SideBarSegment`
* Add a field named 'list-before' with a value of `$:/core/ui/SideBarSegments/tabs`

Important note: Setting `$:/config/DragAndDrop/Enable` to "no" also disables use of drag-and-drop for re-ordering items within tag dropdowns.  To avoid this side-effect, instead of setting `$:/config/DragAndDrop/Enable` to "no", you can disable the drag-and-drop $:/Import handling by editing the `$:/core/ui/PageTemplate` shadow tiddler and completely removing the `<$dropzone ...>` and `</$dropzone>` widgets from that tiddler.  This leaves the tag dropdown handling intact, while still preventing page-wide drag-and-drop $:/Import handling from being triggered.

enjoy,
-e

On Sunday, May 28, 2023 at 8:56:37 AM UTC-7 cj.v...@gmail.com wrote:
https://youtu.be/-UNSlUzdAY8

Charlie Veniot

unread,
May 28, 2023, 5:02:22 PM5/28/23
to TiddlyWiki
Okay, now that I'm back from slamming my forehead against a door frame for not having brought this up earlier...

Thank-you much, Eric !

Does that ever make a huge difference.  I'm sure that's going to help me immensely, and I'm going to set that up in all my TiddlyWiki instances.

Charlie Veniot

unread,
May 28, 2023, 8:53:31 PM5/28/23
to TiddlyWiki
For my personal use, I'm experimenting with making TiddlyWiki titles the dropzone area:

Screenshot 2023-05-28 9.49.33 PM.png

Reply all
Reply to author
Forward
0 new messages