mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-17 11:30:02 +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) {
|
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,6 +56,7 @@ 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
|
||||||
|
if(this.dragEnable) {
|
||||||
$tw.utils.makeDraggable({
|
$tw.utils.makeDraggable({
|
||||||
domNode: domNode,
|
domNode: domNode,
|
||||||
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
|
||||||
@ -66,6 +67,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
widget: this,
|
widget: this,
|
||||||
selector: self.dragHandleSelector
|
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…
x
Reference in New Issue
Block a user