1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Add "class" attribute to dropzone widget

This commit is contained in:
Jeremy Ruston 2020-04-03 10:33:39 +01:00
parent bd449a177b
commit cf46b6b0ff
2 changed files with 4 additions and 2 deletions

View File

@ -35,7 +35,7 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
this.execute();
// Create element
var domNode = this.document.createElement("div");
domNode.className = "tc-dropzone";
domNode.className = this.dropzoneClass || "tc-dropzone";
// Add event handlers
if(this.dropzoneEnable) {
$tw.utils.addEventListeners(domNode,[
@ -190,6 +190,7 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
Compute the internal state of the widget
*/
DropZoneWidget.prototype.execute = function() {
this.dropzoneClass = this.getAttribute("class");
this.dropzoneDeserializer = this.getAttribute("deserializer");
this.dropzoneEnable = (this.getAttribute("enable") || "yes") === "yes";
// Make child widgets

View File

@ -1,6 +1,6 @@
caption: dropzone
created: 20131024141900000
modified: 20200315144454996
modified: 20200403103224328
tags: Widgets
title: DropzoneWidget
type: text/vnd.tiddlywiki
@ -16,6 +16,7 @@ It sends a [[WidgetMessage: tm-import-tiddlers]] carrying a JSON representation
|!Attribute |!Description |
|deserializer |<<.from-version "5.1.15">> Optional name of deserializer to be used (by default the deserializer is derived from the file extension) |
|enable |<<.from-version "5.1.22">> Optional value "no" to disable the dropzone functionality (defaults to "yes") |
|class |<<.from-version "5.1.22">> Optional CSS class to be assigned to the dropzone (defaults to "tc-drag-over") |
The list of available deserializers can be inspected by executing `Object.keys($tw.Wiki.tiddlerDeserializerModules).sort().join("\n")` in the browser JavaScript console.