Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/in-same-table / inSameTable

Function: inSameTable()

ts
function inSameTable($cellA, $cellB): boolean;

Defined in: tables/src/utils/in-same-table.ts:22

Checks if two cell positions are within the same table.

Two cells are considered to be in the same table if they have the same depth and the first cell's position is within the bounds of the second cell's parent table.

Parameters

ParameterTypeDescription
$cellAResolvedPosThe resolved position of the first cell.
$cellBResolvedPosThe resolved position of the second cell.

Returns

boolean

True if both cells are in the same table, false otherwise.

Example

typescript
if (inSameTable($anchorCell, $headCell)) {
  // Create a cell selection spanning these cells
}