Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/cell-wrapping / cellWrapping

Function: cellWrapping()

ts
function cellWrapping($pos): Node_2;

Defined in: tables/src/utils/cell-wrapping.ts:24

Finds the cell node that wraps the given position.

Unlike cellAround, this function returns the actual cell node rather than a resolved position. It checks the current depth and all ancestor nodes to find a cell.

Parameters

ParameterTypeDescription
$posResolvedPosThe resolved position to search from.

Returns

Node_2

The cell node wrapping the position, or null if not inside a cell.

Example

typescript
const cellNode = cellWrapping(state.selection.$head);
if (cellNode) {
  console.log("Cell colspan:", cellNode.attrs.colspan);
}