kopia lustrzana https://github.com/miklobit/TiddlyWiki5
rodzic
f70cee6907
commit
e9e5d37ff0
|
@ -16,7 +16,7 @@ Browser data transfer utilities, used with the clipboard and drag and drop
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
domNode: dom node to make draggable
|
domNode: dom node to make draggable
|
||||||
dragImageType: "pill" or "dom"
|
dragImageType: "pill", "blank" or "dom" (the default)
|
||||||
dragTiddlerFn: optional function to retrieve the title of tiddler to drag
|
dragTiddlerFn: optional function to retrieve the title of tiddler to drag
|
||||||
dragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag
|
dragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag
|
||||||
widget: widget to use as the contect for the filter
|
widget: widget to use as the contect for the filter
|
||||||
|
@ -73,6 +73,9 @@ exports.makeDraggable = function(options) {
|
||||||
if(dataTransfer.setDragImage) {
|
if(dataTransfer.setDragImage) {
|
||||||
if(dragImageType === "pill") {
|
if(dragImageType === "pill") {
|
||||||
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
|
||||||
|
} else if (dragImageType === "blank") {
|
||||||
|
dragImage.removeChild(dragImage.firstChild);
|
||||||
|
dataTransfer.setDragImage(dragImage,0,0);
|
||||||
} else {
|
} else {
|
||||||
var r = domNode.getBoundingClientRect();
|
var r = domNode.getBoundingClientRect();
|
||||||
dataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top);
|
dataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top);
|
||||||
|
|
|
@ -54,6 +54,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
|
||||||
dragFilterFn: function() {return self.getAttribute("filter");},
|
dragFilterFn: function() {return self.getAttribute("filter");},
|
||||||
startActions: self.startActions,
|
startActions: self.startActions,
|
||||||
endActions: self.endActions,
|
endActions: self.endActions,
|
||||||
|
dragImageType: self.dragImageType,
|
||||||
widget: this
|
widget: this
|
||||||
});
|
});
|
||||||
// Insert the link into the DOM and render any children
|
// Insert the link into the DOM and render any children
|
||||||
|
@ -71,6 +72,7 @@ DraggableWidget.prototype.execute = function() {
|
||||||
this.draggableClasses = this.getAttribute("class");
|
this.draggableClasses = this.getAttribute("class");
|
||||||
this.startActions = this.getAttribute("startactions");
|
this.startActions = this.getAttribute("startactions");
|
||||||
this.endActions = this.getAttribute("endactions");
|
this.endActions = this.getAttribute("endactions");
|
||||||
|
this.dragImageType = this.getAttribute("dragimagetype");
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
caption: draggable
|
caption: draggable
|
||||||
created: 20170406081938627
|
created: 20170406081938627
|
||||||
modified: 20190118084621046
|
modified: 20210912141544224
|
||||||
tags: Widgets
|
tags: Widgets
|
||||||
title: DraggableWidget
|
title: DraggableWidget
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
@ -20,6 +20,7 @@ See DragAndDropMechanism for an overview.
|
||||||
|tag |Optional tag to override the default "div" element |
|
|tag |Optional tag to override the default "div" element |
|
||||||
|startactions |Optional action string that gets invoked when dragging ''starts'' |
|
|startactions |Optional action string that gets invoked when dragging ''starts'' |
|
||||||
|endactions |Optional action string that gets invoked when dragging ''ends'' |
|
|endactions |Optional action string that gets invoked when dragging ''ends'' |
|
||||||
|
|dragimagetype |<<.from-version "5.2.0">> Optional type of drag image: `dom` (the default) or `blank` to disable the drag image |
|
||||||
|
|
||||||
Either or both of the ''tiddler'' and ''filter'' attributes must be specified in order for there to be a payload to drag.
|
Either or both of the ''tiddler'' and ''filter'' attributes must be specified in order for there to be a payload to drag.
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue