Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/is-in-table / isInTable

Function: isInTable()

ts
function isInTable(state): boolean;

Defined in: tables/src/utils/is-in-table.ts:21

Checks whether the current selection is inside a table.

This function examines the selection's head position and traverses up the document tree to determine if any ancestor is a table row.

Parameters

ParameterTypeDescription
statePmEditorStateThe current editor state.

Returns

boolean

True if the selection is inside a table, false otherwise.

Example

typescript
if (isInTable(state)) {
  // Enable table-specific commands
}