mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
Add a hidden setting for disabling the page dropzone
This commit is contained in:
parent
a6f6db40d9
commit
bc687e5783
@ -37,14 +37,16 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
|
||||
var domNode = this.document.createElement("div");
|
||||
domNode.className = "tc-dropzone";
|
||||
// Add event handlers
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
{name: "dragenter", handlerObject: this, handlerMethod: "handleDragEnterEvent"},
|
||||
{name: "dragover", handlerObject: this, handlerMethod: "handleDragOverEvent"},
|
||||
{name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"},
|
||||
{name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"},
|
||||
{name: "paste", handlerObject: this, handlerMethod: "handlePasteEvent"},
|
||||
{name: "dragend", handlerObject: this, handlerMethod: "handleDragEndEvent"}
|
||||
]);
|
||||
if(this.dropzoneEnable) {
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
{name: "dragenter", handlerObject: this, handlerMethod: "handleDragEnterEvent"},
|
||||
{name: "dragover", handlerObject: this, handlerMethod: "handleDragOverEvent"},
|
||||
{name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"},
|
||||
{name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"},
|
||||
{name: "paste", handlerObject: this, handlerMethod: "handlePasteEvent"},
|
||||
{name: "dragend", handlerObject: this, handlerMethod: "handleDragEndEvent"}
|
||||
]);
|
||||
}
|
||||
domNode.addEventListener("click",function (event) {
|
||||
},false);
|
||||
// Insert element
|
||||
@ -189,6 +191,7 @@ Compute the internal state of the widget
|
||||
*/
|
||||
DropZoneWidget.prototype.execute = function() {
|
||||
this.dropzoneDeserializer = this.getAttribute("deserializer");
|
||||
this.dropzoneEnable = (this.getAttribute("enable") || "yes") === "yes";
|
||||
// Make child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@ -197,6 +200,11 @@ DropZoneWidget.prototype.execute = function() {
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
DropZoneWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.enable) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
|
||||
<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>
|
||||
|
||||
<$dropzone>
|
||||
<$dropzone enable={{$:/config/PageDropzone/Enable}}>
|
||||
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageTemplate]!has[draft.of]]" variable="listItem">
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
created: 20200315143638556
|
||||
modified: 20200315143638556
|
||||
tags: [[Hidden Settings]]
|
||||
title: Hidden Setting: Disable Page Dropzone
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
To disable the main DropzoneWidget, set the following tiddler to "no":
|
||||
|
||||
$:/config/PageDropzone/Enable
|
@ -1,6 +1,6 @@
|
||||
caption: dropzone
|
||||
created: 20131024141900000
|
||||
modified: 20170712153850528
|
||||
modified: 20200315144454996
|
||||
tags: Widgets
|
||||
title: DropzoneWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -15,6 +15,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") |
|
||||
|
||||
The list of available deserializers can be inspected by executing `Object.keys($tw.Wiki.tiddlerDeserializerModules).sort().join("\n")` in the browser JavaScript console.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user