@docx-editor.dev/core/prosemirror/tableResize

Functions (6)

commitColumnResizefunctionSource ↗

Bake a column-resize into the PM doc: update the table's columnWidths attr and every cell at colIdx / colIdx + 1 in every row.

declare function commitColumnResize(view: EditorView, opts: {
    docFrom: number;
    colIdx: number;
    newLeft: number;
    newRight: number;
}): void;

commitRightEdgeResizefunctionSource ↗

Bake a right-edge resize into the PM doc: grow only the last column. Updates columnWidths[colIdx] and the cell at colIdx in every row.

declare function commitRightEdgeResize(view: EditorView, opts: {
    docFrom: number;
    colIdx: number;
    newWidth: number;
}): void;

commitRowResizefunctionSource ↗

Bake a row-resize into the PM doc: update the target row's height + heightRule.

declare function commitRowResize(view: EditorView, opts: {
    docFrom: number;
    rowIdx: number;
    newHeight: number;
}): void;

readColumnWidthAtfunctionSource ↗

Read the last-column width (the one being resized from the table's right edge).

declare function readColumnWidthAt(view: EditorView, docFrom: number, colIndex: number): number | null;

readColumnWidthsfunctionSource ↗

Read the [left, right] column widths at colIndex in the table starting at docFrom.

declare function readColumnWidths(view: EditorView, docFrom: number, colIndex: number): {
    left: number;
    right: number;
} | null;

readRowHeightfunctionSource ↗

Read the row height (in twips) for rowIndex in the table starting at docFrom. Returns null if the row has no explicit height — the caller can fall back to measuring the rendered DOM cell.

declare function readRowHeight(view: EditorView, docFrom: number, rowIndex: number): number | null;

Variables (3)

MIN_CELL_WIDTH_TWIPSconstSource ↗

Minimum column width (~0.2").

MIN_CELL_WIDTH_TWIPS = 300

MIN_ROW_HEIGHT_TWIPSconstSource ↗

Minimum row height (~0.14").

MIN_ROW_HEIGHT_TWIPS = 200

TWIPS_PER_PIXELconstSource ↗

1px ≈ 15 twips at 96dpi (20 twips/pt × 72pt/in ÷ 96px/in).

TWIPS_PER_PIXEL = 15

On this page