Type Editor / @type-editor/commands / util/helpers / deleteBarrier
Function: deleteBarrier()
ts
function deleteBarrier(state, $cut, dispatch, direction): boolean;Defined in: util/helpers.ts:471
Attempts to delete or join nodes separated by a structural barrier.
This is a complex function that implements multiple strategies for handling deletion or joining when there's a structural barrier (like different node types or isolating nodes) between content. It tries several approaches in order:
- Simple Join: Try basic joining if nodes are compatible
- Wrap and Merge: Wrap the after node to make it compatible, then merge
- Lift: Lift the after content up in the hierarchy
- Join Textblocks: Find and join inner textblocks across the barrier
This function is used by backward and forward joining commands to handle complex structural scenarios that simple joining can't handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | PmEditorState | The current editor state |
$cut | ResolvedPos | The position where the barrier exists |
dispatch | DispatchFunction | Optional dispatch function to execute the transaction |
direction | number | Direction of operation (-1 for backward, 1 for forward) |
Returns
boolean
true if any strategy succeeded, false otherwise