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

browser-messaging-saver
Saq Imtiaz 2020-12-15 12:09:32 +01:00 zatwierdzone przez GitHub
rodzic f968130696
commit 1e9cc2b747
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -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;
})();
})();