Skip to content

Type Editor


Type Editor / @type-editor/tables / utils/add-col-span

utils/add-col-span

Functions

FunctionDescription

addColSpan

Creates new cell attributes with increased colspan.

Adds the specified number of columns to the cell's span, inserting zeros at the specified position in the colwidth array if it exists.

Example

typescript
const attrs = { colspan: 2, rowspan: 1, colwidth: [100, 200] };
const newAttrs = addColSpan(attrs, 1, 1);
// newAttrs = { colspan: 3, rowspan: 1, colwidth: [100, 0, 200] }