From 1e9cc2b747e9f8b7b9366cde2c452d52a4d172a5 Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Tue, 15 Dec 2020 12:09:32 +0100 Subject: [PATCH] Fix refresh for all attributes of droppable widget. Add disabled class (#5280) --- core/modules/widgets/droppable.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/droppable.js b/core/modules/widgets/droppable.js index 87a130f39..c9878930d 100644 --- a/core/modules/widgets/droppable.js +++ b/core/modules/widgets/droppable.js @@ -50,6 +50,8 @@ DroppableWidget.prototype.render = function(parent,nextSibling) { {name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"}, {name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"} ]); + } else { + $tw.utils.addClass(this.domNode,this.disabledClass); } // Insert element parent.insertBefore(domNode,nextSibling); @@ -145,6 +147,7 @@ DroppableWidget.prototype.execute = function() { this.droppableEffect = this.getAttribute("effect","copy"); this.droppableTag = this.getAttribute("tag"); this.droppableEnable = (this.getAttribute("enable") || "yes") === "yes"; + this.disabledClass = this.getAttribute("disabledClass",""); // Make child widgets 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) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.tag || changedAttributes.enable) { + if(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) { this.refreshSelf(); return true; } else if(changedAttributes["class"]) { @@ -171,4 +174,4 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) { exports.droppable = DroppableWidget; -})(); +})(); \ No newline at end of file