OptionalhandleEvent: (e: PointerEvent | KeyboardEvent, state: DragState) => booleanOptionalmodifyDecos: (Modify the created decos before they are rendered.
Optionalconfig: { debug?: string | boolean }Plugins should implement some basic debug logs by calling DragActionHandler.debugState at least before and after applying actions in onDragApply. Debug can be a string because it can be an object key to filter on (see the debugState function).
Calls look like this usually, where this.state is the plugin state:
DragActionHandler.debugState(this.name, "before", state, this.state, this.debug)
A unique name for your action.
Called when a user cancels the drag action.
You should reset your state here.
Should return true if it should handle the "request"/event (e.g. some modifier is being pressed => user is requesting x action).
The user is not necessarily dragging at this point, though they might also change actions mid drag. So it does not necessarily mean the event is allowed.
Here is where you should initiate your state. Don't allow the action by default unless it can always be allowed.
The action handler will call this regardless of whether the action is active or not.
Can be used by actions to return display hints.
Actions should keep the state of the hints locally and update them in canHandlerRequest/onDrag*, etc. and only use this to return the state of the actions, not update them as that could become expensive.
Is called after onDragChange("end") with the same event. Might not be called if the request was cancelled.
You should apply your action if possible and return whether it was applied.
This is also a good place to reset your state.
A drag action describes when and how to handle a drag event.
For example, there are the default split/close actions that can be triggered in certain situations. This could be when holding down a modifier or key, or some other condition (e.g. the user is dragging a specific edge).
Each action should handle it's configuration and saving/caching any state it needs. See SplitAction and CloseAction for examples.