Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/find-cell / findCell

Function: findCell()

ts
function findCell($pos): Rect;

Defined in: tables/src/utils/find-cell.ts:22

Finds the rectangular bounds of the cell at the given position.

Uses the table map to determine the cell's position in the table grid, accounting for any rowspan or colspan that may affect its bounds.

Parameters

ParameterTypeDescription
$posResolvedPosA resolved position pointing at or within a cell.

Returns

Rect

A rectangle describing the cell's bounds in the table grid.

Example

typescript
const rect = findCell($cellPos);
console.log(`Cell spans from column ${rect.left} to ${rect.right}`);