diff --git a/core/modules/utils/dom/dragndrop.js b/core/modules/utils/dom/dragndrop.js index 3e10d456d..b6b381f37 100644 --- a/core/modules/utils/dom/dragndrop.js +++ b/core/modules/utils/dom/dragndrop.js @@ -16,7 +16,7 @@ Browser data transfer utilities, used with the clipboard and drag and drop Options: 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 dragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag widget: widget to use as the contect for the filter @@ -73,6 +73,9 @@ exports.makeDraggable = function(options) { if(dataTransfer.setDragImage) { if(dragImageType === "pill") { dataTransfer.setDragImage(dragImage.firstChild,-16,-16); + } else if (dragImageType === "blank") { + dragImage.removeChild(dragImage.firstChild); + dataTransfer.setDragImage(dragImage,0,0); } else { var r = domNode.getBoundingClientRect(); dataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top); diff --git a/core/modules/widgets/draggable.js b/core/modules/widgets/draggable.js index e12f2c693..66f85132d 100644 --- a/core/modules/widgets/draggable.js +++ b/core/modules/widgets/draggable.js @@ -54,6 +54,7 @@ DraggableWidget.prototype.render = function(parent,nextSibling) { dragFilterFn: function() {return self.getAttribute("filter");}, startActions: self.startActions, endActions: self.endActions, + dragImageType: self.dragImageType, widget: this }); // Insert the link into the DOM and render any children @@ -71,6 +72,7 @@ DraggableWidget.prototype.execute = function() { this.draggableClasses = this.getAttribute("class"); this.startActions = this.getAttribute("startactions"); this.endActions = this.getAttribute("endactions"); + this.dragImageType = this.getAttribute("dragimagetype"); // Make the child widgets this.makeChildWidgets(); }; diff --git a/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid b/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid index b0885bb9a..babfaf1ef 100644 --- a/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid @@ -1,6 +1,6 @@ caption: draggable created: 20170406081938627 -modified: 20190118084621046 +modified: 20210912141544224 tags: Widgets title: DraggableWidget type: text/vnd.tiddlywiki @@ -20,6 +20,7 @@ See DragAndDropMechanism for an overview. |tag |Optional tag to override the default "div" element | |startactions |Optional action string that gets invoked when dragging ''starts'' | |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.