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

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

6 Likes

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.

1 Like

For my personal use, I’m experimenting with making TiddlyWiki titles the dropzone area: