Skip to content

Type Editor


Type Editor / @type-editor/tables / fixtables/fix-tables / fixTables

Function: fixTables()

ts
function fixTables(state, oldState?): PmTransaction;

Defined in: tables/src/fixtables/fix-tables.ts:26

Inspects all tables in the given state's document and returns a transaction that fixes any structural issues, if necessary.

When a previous known-good state is provided, only the changed parts of the document are scanned, which improves performance for large documents.

Parameters

ParameterTypeDescription
statePmEditorStateThe current editor state to inspect for table issues
oldState?PmEditorStateOptional previous state used to optimize by only scanning changed document regions

Returns

PmTransaction

A transaction with the fixes applied, or undefined if no fixes were needed