[tw5] is it possible to disable drag and drop completely with a simple stylesheet?

111 views
Skip to first unread message

ch

unread,
Jan 14, 2019, 2:10:27 PM1/14/19
to TiddlyWiki
hi,

i've made a simple "read-only-mode" of a wiki (with a couple of macros, stylesheets and viewtemplates), but noticed that i also need to disable drag and drop completely (i.e. not able to drag and drop anything within the wiki or from other windows) so that tiddler "$:/Import" doesn't pop-up when an item is dropped into the wiki.

so, is it possible to implement this feature with a simple stylesheet, or other configuration options?

kind regards,

ch

TonyM

unread,
Jan 17, 2019, 6:15:33 PM1/17/19
to TiddlyWiki
Quick and Dirty

The Tiddler $:/core/ui/ViewTemplate/import is tagged with $:/tags/ViewTemplate the 

$:/Import

Tiddler will be created and Opened but you can't import anything

Less Dirty (but edits important shadow tiddler)

Edit 

$:/core/ui/PageTemplate


And remove <$dropzone> and </$dropzone>

Delete your edited $:/core/ui/PageTemplate to restore function

Regards
Tony

ch

unread,
Jan 21, 2019, 12:44:55 PM1/21/19
to tiddl...@googlegroups.com
- thanks tony!

i did go with the latter method, i.e.removed the DropzoneWidget in the shadow tiddler '$:/core/ui/PageTemplate' - which works perfectly! (as much as i have tested, so far...) - no more "$:/Import" tiddler that did pop-up without this fix - great!

however, a side effect of this change makes it possible (for example) to drag a url and drop it into my "read-only-mode" wiki, and the browser does in fact look-up that url! :-) i guess that's the default behaviour for browsers to do. but, it's easy to go back since the user can just hit the back button, and my "read-only-mode" single-file-wiki is reloaded from disk - to extend the feature, maybe it could be nice to disable (or maybe not, since it's the de-facto way for browsers to do...) the standard behaviour - to look-up the new url - and just ignore the "url drop". anyway, no more "$:/Import" tiddler to confuse the readers of the "read-only-mode" wiki - thanks again, tony!

i think this is a feature that would be nice to have with an "easy tick" check box in the configuration panel

cheers!
/ch

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/ffda72b6-3552-47bb-bfb4-f8c7641e7fcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Jan 21, 2019, 5:50:34 PM1/21/19
to TiddlyWiki
Ch,

Yes, it does look like in the absence of import dropping a link on a browser window results in the default browser response to navigate to that address.

If you do allow drop, but don't display anything be careful in the case that someone drops a very large file on top, as it will be stored in the active wiki pending import until reload, this could impact performance. 

Try replacing the content of $:/core/ui/ViewTemplate/import with
\define lingo-base() $:/language/Import/


\define buttons()
<$button message="tm-delete-tiddler" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>
\end


<$list filter="[all[current]field:plugin-type[import]]">


<div class="tc-import">


Import is not permitted in this wiki, please cancel


<<buttons>>


{{||$:/core/ui/ImportListing}}


<<buttons>>


</div>


</
$list>

It will thus accept the drop, list the import but only allow cancel.

Regards
Tony

ch

unread,
Jan 24, 2019, 11:07:55 AM1/24/19
to tiddl...@googlegroups.com
hi tony,

i tried your example with modifying the shadow tiddler ' $:/core/ui/ViewTemplate/import' - but didn't like it, because the "read-only-mode" wiki user will probably get confused and questioning what is really going on with this '$:/Import' thing, i think.

- removing <$dropzone> and </$dropzone> in shadow tiddler ' $:/core/ui/PageTemplate ' seem to do the work very well - thanks again!

cheers!
ch

Reply all
Reply to author
Forward
0 new messages