Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1534x 1534x 1534x | import type {
ContentModelTableCell,
ContentModelTableCellFormat,
ReadonlyDatasetFormat,
} from 'roosterjs-content-model-types';
/**
* Create a ContentModelTableCell model
* @param spanLeftOrColSpan @optional Whether this is a table cell merged with its left cell, or colspan number @default false
* @param spanAboveOrRowSpan Whether this is a table cell merged with its upper cell, or rowSpan number @default false
* @param isHeader @optional Whether this is a header cell @default false
* @param format @optional The format of this model
*/
export function createTableCell(
spanLeftOrColSpan?: boolean | number,
spanAboveOrRowSpan?: boolean | number,
isHeader?: boolean,
format?: Readonly<ContentModelTableCellFormat>,
dataset?: ReadonlyDatasetFormat
): ContentModelTableCell {
const spanLeft =
typeof spanLeftOrColSpan === 'number' ? spanLeftOrColSpan > 1 : !!spanLeftOrColSpan;
const spanAbove =
typeof spanAboveOrRowSpan === 'number' ? spanAboveOrRowSpan > 1 : !!spanAboveOrRowSpan;
return {
blockGroupType: 'TableCell',
blocks: [],
format: { ...format },
spanLeft,
spanAbove,
isHeader: !!isHeader,
dataset: { ...dataset },
};
}
|