Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/cell-around

utils/cell-around

Functions

FunctionDescription

cellAround

Finds the resolved position of the cell containing the given position.

This function walks up the document tree from the given position to find the nearest cell boundary. It returns a resolved position pointing to the start of the cell node.

Example

typescript
const $cell = cellAround(state.selection.$head);
if ($cell) {
  console.log("Cursor is in cell at position:", $cell.pos);
}