getNodeAtPosition
@blockslides/core / getNodeAtPosition
Function: getNodeAtPosition()
getNodeAtPosition(
state,typeOrName,pos,maxDepth): [Node|null,number]
Defined in: blockslides/packages/core/src/helpers/getNodeAtPosition.ts:12
Finds the first node of a given type or name in the current selection.
Parameters
state
EditorState
The editor state.
typeOrName
The node type or name.
string | NodeType
pos
number
The position to start searching from.
maxDepth
number = 20
The maximum depth to search.
Returns
[Node | null, number]
The node and the depth as an array.