Add "enabled" attribute to draggable widget (#6581)
* Add "enabled" attribute to draggable widget * Update draggable.js * Update draggable.js * Update draggable.js
This commit is contained in:
parent
58dd47d128
commit
030155ec27
|
@ -48,7 +48,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||||
if(this.draggableClasses) {
|
if(this.draggableClasses) {
|
||||||
classes.push(this.draggableClasses);
|
classes.push(this.draggableClasses);
|
||||||
}
|
}
|
||||||
if(!this.dragHandleSelector) {
|
if(!this.dragHandleSelector && this.dragEnable) {
|
||||||
classes.push("tc-draggable");
|
classes.push("tc-draggable");
|
||||||
}
|
}
|
||||||
domNode.setAttribute("class",classes.join(" "));
|
domNode.setAttribute("class",classes.join(" "));
|
||||||
|
@ -56,16 +56,18 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
// Add event handlers
|
// Add event handlers
|
||||||
$tw.utils.makeDraggable({
|
if(this.dragEnable) {
|
||||||
domNode: domNode,
|
$tw.utils.makeDraggable({
|
||||||
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
domNode: domNode,
|
||||||
dragFilterFn: function() {return self.getAttribute("filter");},
|
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
||||||
startActions: self.startActions,
|
dragFilterFn: function() {return self.getAttribute("filter");},
|
||||||
endActions: self.endActions,
|
startActions: self.startActions,
|
||||||
dragImageType: self.dragImageType,
|
endActions: self.endActions,
|
||||||
widget: this,
|
dragImageType: self.dragImageType,
|
||||||
selector: self.dragHandleSelector
|
widget: this,
|
||||||
});
|
selector: self.dragHandleSelector
|
||||||
|
});
|
||||||
|
}
|
||||||
this.domNodes.push(domNode);
|
this.domNodes.push(domNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,6 +82,7 @@ DraggableWidget.prototype.execute = function() {
|
||||||
this.endActions = this.getAttribute("endactions");
|
this.endActions = this.getAttribute("endactions");
|
||||||
this.dragImageType = this.getAttribute("dragimagetype");
|
this.dragImageType = this.getAttribute("dragimagetype");
|
||||||
this.dragHandleSelector = this.getAttribute("selector");
|
this.dragHandleSelector = this.getAttribute("selector");
|
||||||
|
this.dragEnable = this.getAttribute("enable","yes") === "yes";
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
|
@ -89,7 +92,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||||
*/
|
*/
|
||||||
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
DraggableWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(changedAttributes.tag || changedAttributes["class"]) {
|
if($tw.utils.count(changedAttributes) > 0) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue