/** * Row template formatting * @typedef {Object} RowTemplateFormatting * @property {import('prosemirror-model').NodeType} blockType - Node type used when building cell content * @property {Object|null} blockAttrs - Attributes to apply to the created block node * @property {Array} textMarks - Marks copied from the template text node */ /** * Build row from template row parameters * @typedef {Object} BuildRowFromTemplateRowParams * @property {import('prosemirror-model').Schema} schema - Editor schema * @property {import('prosemirror-model').Node} tableNode - Table node used for column map lookup * @property {import('prosemirror-model').Node} templateRow - Row providing structure and formatting * @property {Array} values - Values to populate each table cell * @property {boolean} [copyRowStyle=false] - Clone template marks and block attrs when true */ /** * Insert rows at table end parameters * @typedef {Object} InsertRowsAtTableEndParams * @property {import('prosemirror-state').Transaction} tr - Transaction to mutate * @property {number} tablePos - Absolute position of the target table * @property {import('prosemirror-model').Node} tableNode - Table node receiving new rows * @property {import('prosemirror-model').Node[]} rows - Row nodes to append */ /** * Resolve the table node that should receive appended rows. * Prefers an explicit table node, falling back to a position lookup. * @private * @param {import('prosemirror-state').Transaction} tr - Current transaction * @param {number} [tablePos] - Absolute position of the table in the document * @param {import('prosemirror-model').Node} [tableNode] - Explicit table node reference * @returns {import('prosemirror-model').Node|null} Table node to append rows to, or null if not found */ export function resolveTable(tr: import('prosemirror-state').Transaction, tablePos?: number, tableNode?: import('prosemirror-model').Node): import('prosemirror-model').Node | null; /** * Select the template row used to derive structure and attributes for appended rows. * Prefers the last body row (containing table cells) and falls back to the last row in the table. * @private * @param {import('prosemirror-model').Node} tableNode - Table node to inspect * @param {import('prosemirror-model').Schema} schema - Editor schema * @returns {import('prosemirror-model').Node|null} Template row node or null if none exist */ export function pickTemplateRowForAppend(tableNode: import('prosemirror-model').Node, schema: import('prosemirror-model').Schema): import('prosemirror-model').Node | null; /** * Extract block type, attributes, and text marks from a template cell. * Used to reproduce formatting when constructing new row content. * @private * @param {import('prosemirror-model').Node} cellNode - Template cell node * @param {import('prosemirror-model').Schema} schema - Editor schema * @returns {RowTemplateFormatting} Formatting info */ export function extractRowTemplateFormatting(cellNode: import('prosemirror-model').Node, schema: import('prosemirror-model').Schema): RowTemplateFormatting; /** * Create a block node for a new cell, optionally applying marks from the template row. * @private * @param {import('prosemirror-model').Schema} schema - Editor schema * @param {string|any} value - Cell text value * @param {RowTemplateFormatting} formatting - Template formatting info * @param {boolean} [copyRowStyle=false] - Whether to copy marks from the template row * @returns {import('prosemirror-model').Node | import('prosemirror-model').Fragment} Block node(s) ready to insert into the cell */ export function buildFormattedCellBlock(schema: import('prosemirror-model').Schema, value: string | any, { blockType, blockAttrs, textMarks }: RowTemplateFormatting, copyRowStyle?: boolean): import('prosemirror-model').Node | import('prosemirror-model').Fragment; /** * Construct a new table row by cloning structure from a template row and filling in values. * Handles colspan-based value mapping and optional style copying. * @private * @param {BuildRowFromTemplateRowParams} params - Build parameters * @returns {import('prosemirror-model').Node|null} Newly created table row node */ export function buildRowFromTemplateRow({ schema, tableNode, templateRow, values, copyRowStyle }: BuildRowFromTemplateRowParams): import('prosemirror-model').Node | null; /** * Append one or more rows to the end of a table in a single transaction. * @private * @param {InsertRowsAtTableEndParams} params - Insert parameters */ export function insertRowsAtTableEnd({ tr, tablePos, tableNode, rows }: InsertRowsAtTableEndParams): void; /** * Insert a new row at a specific index, copying formatting from a source row. * Handles rowspan cells properly by incrementing their rowspan when they span * across the insertion point. * @param {Object} params - Insert parameters * @param {import('prosemirror-state').Transaction} params.tr - Transaction to mutate * @param {number} params.tablePos - Absolute position of the table * @param {import('prosemirror-model').Node} params.tableNode - Table node * @param {number} params.sourceRowIndex - Index of the row to copy formatting from * @param {number} params.insertIndex - Index where the new row should be inserted * @param {import('prosemirror-model').Schema} params.schema - Editor schema * @returns {boolean} True if successful */ export function insertRowAtIndex({ tr, tablePos, tableNode, sourceRowIndex, insertIndex, schema }: { tr: import('prosemirror-state').Transaction; tablePos: number; tableNode: import('prosemirror-model').Node; sourceRowIndex: number; insertIndex: number; schema: import('prosemirror-model').Schema; }): boolean; /** * Row template formatting */ export type RowTemplateFormatting = { /** * - Node type used when building cell content */ blockType: import('prosemirror-model').NodeType; /** * - Attributes to apply to the created block node */ blockAttrs: Object | null; /** * - Marks copied from the template text node */ textMarks: Array; }; /** * Build row from template row parameters */ export type BuildRowFromTemplateRowParams = { /** * - Editor schema */ schema: import('prosemirror-model').Schema; /** * - Table node used for column map lookup */ tableNode: import('prosemirror-model').Node; /** * - Row providing structure and formatting */ templateRow: import('prosemirror-model').Node; /** * - Values to populate each table cell */ values: any[]; /** * - Clone template marks and block attrs when true */ copyRowStyle?: boolean | undefined; }; /** * Insert rows at table end parameters */ export type InsertRowsAtTableEndParams = { /** * - Transaction to mutate */ tr: import('prosemirror-state').Transaction; /** * - Absolute position of the target table */ tablePos: number; /** * - Table node receiving new rows */ tableNode: import('prosemirror-model').Node; /** * - Row nodes to append */ rows: import('prosemirror-model').Node[]; }; //# sourceMappingURL=appendRows.d.ts.map