1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 06:13:17 +00:00

Fix refresh for all attributes of droppable widget. Add disabled class (#5280)

This commit is contained in:
Saq Imtiaz 2020-12-15 12:09:32 +01:00 committed by GitHub
parent f968130696
commit 1e9cc2b747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,8 @@ DroppableWidget.prototype.render = function(parent,nextSibling) {
{name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"}, {name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"},
{name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"} {name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"}
]); ]);
} else {
$tw.utils.addClass(this.domNode,this.disabledClass);
} }
// Insert element // Insert element
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
@ -145,6 +147,7 @@ DroppableWidget.prototype.execute = function() {
this.droppableEffect = this.getAttribute("effect","copy"); this.droppableEffect = this.getAttribute("effect","copy");
this.droppableTag = this.getAttribute("tag"); this.droppableTag = this.getAttribute("tag");
this.droppableEnable = (this.getAttribute("enable") || "yes") === "yes"; this.droppableEnable = (this.getAttribute("enable") || "yes") === "yes";
this.disabledClass = this.getAttribute("disabledClass","");
// Make child widgets // Make child widgets
this.makeChildWidgets(); this.makeChildWidgets();
}; };
@ -160,7 +163,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/ */
DroppableWidget.prototype.refresh = function(changedTiddlers) { DroppableWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
if(changedAttributes.tag || changedAttributes.enable) { if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} else if(changedAttributes["class"]) { } else if(changedAttributes["class"]) {
@ -171,4 +174,4 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) {
exports.droppable = DroppableWidget; exports.droppable = DroppableWidget;
})(); })();