1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-29 21:09:56 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/widgets/DraggableWidget.tid

37 lines
2.5 KiB
Plaintext
Raw Normal View History

2017-04-06 09:15:22 +00:00
caption: draggable
created: 20170406081938627
modified: 20220223145136863
tags: Widgets TriggeringWidgets
2017-04-06 09:15:22 +00:00
title: DraggableWidget
type: text/vnd.tiddlywiki
The DraggableWidget creates a DOM element that can be dragged by the user. It only works on browsers that support drag and drop, which typically means desktop browsers, but [[there are workarounds|Mobile Drag And Drop Shim Plugin]].
2017-04-06 09:15:22 +00:00
The draggable element can be assigned a list of tiddlers that are used as the payload.
If desired it can invoke actions when dragging starts and when it ends.
See DragAndDropMechanism for an overview.
2017-04-06 09:15:22 +00:00
! Content and Attributes
|!Attribute |!Description |
|tiddler |Optional title of the payload tiddler for the drag |
|filter |Optional filter defining the payload tiddlers for the drag |
|tag |Optional tag to override the default "div" element created by the widget|
|selector|<<.from-version 5.2.2>> Optional CSS Selector to identify a DOM element within the widget that will be used as the drag handle |
|class |Optional CSS classes to assign to the DOM element created by the widget. The class `tc-draggable` is added to the drag handle, which is the same as the DOM element created by the widget unless the <<.param selector>> attribute is used. The class `tc-dragging` is applied to the drag handle while the element is being dragged |
|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 |
2017-04-06 09:15:22 +00:00
Either or both of the ''tiddler'' and ''filter'' attributes must be specified in order for there to be a payload to drag.
The [[actionTiddler Variable]] is accessible in both //startactions// and //endactions//. It holds the payload tiddler(s) specified through the //tiddler// and //filter// attributes as a [[Title List]] using double square brackets to quote titles that include whitespace.
2019-01-18 09:19:58 +00:00
<<.tip """Note that the [[actionTiddler Variable]] holds a [[Title List]] quoted with double square brackets. This is unlike the DroppableWidget which uses the same variable to pass a single unquoted title.""">>
<<.tip """When specifying a DOM node to use as the drag handle with the <<.param selector>> attribute, give it the class `tc-draggable` in order for it to have the appropriate cursor.""">>
2017-04-06 09:15:22 +00:00
The LinkWidget incorporates the functionality of the DraggableWidget via the ''draggable'' attribute.