mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Droppable widget - passing modifiers as variables (#3167)
* pass the modifier keys as variables * Update DroppableWidget.tid * Create modifier Variable.tid * closing bracket got lost
This commit is contained in:
parent
de6e0d1c1e
commit
c9b8319801
@ -128,7 +128,9 @@ DroppableWidget.prototype.handleDropEvent = function(event) {
|
||||
|
||||
DroppableWidget.prototype.performActions = function(title,event) {
|
||||
if(this.droppableActions) {
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title});
|
||||
var modifierKey = event.ctrlKey && ! event.shiftKey ? "ctrl" : event.shiftKey && !event.ctrlKey ? "shift" :
|
||||
event.ctrlKey && event.shiftKey ? "ctrl-shift" : "normal" ;
|
||||
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title, modifier: modifierKey});
|
||||
}
|
||||
};
|
||||
|
||||
|
14
editions/tw5.com/tiddlers/variables/modifier Variable.tid
Normal file
14
editions/tw5.com/tiddlers/variables/modifier Variable.tid
Normal file
@ -0,0 +1,14 @@
|
||||
tags: Variables [[Core Variables]]
|
||||
title: modifier Variable
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Within the ''action'' string of the DroppableWidget, the <<.def modifier>> [[variable|Variables]] contains the modifier key(s) held during the drag-process.
|
||||
The possible keys are ''ctrl'', ''shift'' or both ''ctrl'' and ''shift''
|
||||
|
||||
The variable contains a string that identifies the keys:
|
||||
|
||||
|Modifier Key |Variable Content |h
|
||||
|ctrl |ctrl |
|
||||
|shift |shift |
|
||||
|ctrl+shift |ctrl-shift |
|
||||
|no modifier (normal drag) |normal |
|
@ -31,7 +31,10 @@ See DragAndDropMechanism for an overview.
|
||||
|class |Optional CSS classes to assign to the draggable element. The class `tc-droppable` is added automatically, and the class `tc-dragover` is applied while an item is being dragged over the droppable element |
|
||||
|tag |Optional tag to override the default of a "div" element when the widget is rendered in block mode, or a "span" element when it is rendered in inline mode |
|
||||
|
||||
Within the action string, the [[actionTiddler Variable]] contains the title of the item being dropped.
|
||||
Within the action string, there are two Variables generated by the DroppableWidget:
|
||||
|
||||
* The [[actionTiddler Variable]] contains the title of the item being dropped
|
||||
* The [[modifier Variable]] contains the Modifier Key held while dragging (can be normal, ctrl, shift or ctrl-shift)
|
||||
|
||||
If multiple items are dropped then the actions are performed repeatedly, once for each dropped item.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user