TableCell
Unofficial
Represents a single cell in a markdown table.
Import:
import type { TableCell } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface TableCellProperties
| Property | Type | Description | |
|---|---|---|---|
| col | number | Column index of the cell. | |
| contentEl | HTMLElement | Element containing the cell's content. | |
| dirty | boolean | Whether the cell has been modified since the last save. | |
| el | HTMLElement | DOM element for the cell. | |
| end | number | End offset of the cell content, relative to the start of the table. | |
| padEnd | number | Number of trailing padding spaces in the cell. | |
| padStart | number | Number of leading padding spaces in the cell. | |
| row | number | Row index of the cell. | |
| start | number | Start offset of the cell content, relative to the start of the table. | |
| table | TableEditor | Table widget that owns this cell. | |
| text | string | Text content of the cell, without padding. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| getAbsoluteOffsets() | TableCellOffsets | Get the offsets of the cell within the whole document. | |
| getLength() | number | Get the total length of the cell content including padding. | |
| getTextWithPadding() | string | Get the cell text with its leading and trailing padding spaces. | |
| handleMobileCaretDrag(view, pointerId) | void | Handle a mobile caret drag interaction for this cell. | |
| init(el, start, end) | void | Initialize the cell with a DOM element and its offsets within the table. | |
| lockDimensions() | void | Lock the cell's current dimensions to prevent layout reflow during operations. | |
| scrollIntoView() | void | Scroll the cell into the visible area of the editor. | |
| setTextDir() | void | Set the text direction of the cell based on its content. | |
| updateWidth(width) | void | Recalculate the cell's padding for a target column width, honouring the column's alignment. |
Links to this page: