mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
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) {
|
||||
classes.push(this.draggableClasses);
|
||||
}
|
||||
if(!this.dragHandleSelector) {
|
||||
if(!this.dragHandleSelector && this.dragEnable) {
|
||||
classes.push("tc-draggable");
|
||||
}
|
||||
domNode.setAttribute("class",classes.join(" "));
|
||||
@ -56,6 +56,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
// Add event handlers
|
||||
if(this.dragEnable) {
|
||||
$tw.utils.makeDraggable({
|
||||
domNode: domNode,
|
||||
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
||||
@ -66,6 +67,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||
widget: this,
|
||||
selector: self.dragHandleSelector
|
||||
});
|
||||
}
|
||||
this.domNodes.push(domNode);
|
||||
};
|
||||
|
||||
@ -80,6 +82,7 @@ DraggableWidget.prototype.execute = function() {
|
||||
this.endActions = this.getAttribute("endactions");
|
||||
this.dragImageType = this.getAttribute("dragimagetype");
|
||||
this.dragHandleSelector = this.getAttribute("selector");
|
||||
this.dragEnable = this.getAttribute("enable","yes") === "yes";
|
||||
// Make the child widgets
|
||||
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) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.tag || changedAttributes["class"]) {
|
||||
if($tw.utils.count(changedAttributes) > 0) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user