Type Editor / @type-editor/tables / cellselection/CellBookmark / CellBookmark
Class: CellBookmark
Defined in: tables/src/cellselection/CellBookmark.ts:17
A bookmark for a CellSelection that can survive document changes.
Bookmarks store the raw positions of the anchor and head cells and can be mapped through document transformations. When resolved, they attempt to recreate the original CellSelection or fall back to a nearby selection.
See
Constructors
Constructor
new CellBookmark(anchor, head): CellBookmark;Defined in: tables/src/cellselection/CellBookmark.ts:30
Creates a new CellBookmark.
Parameters
| Parameter | Type | Description |
|---|---|---|
anchor | number | The absolute document position of the anchor cell. |
head | number | The absolute document position of the head cell. |
Returns
CellBookmark
Methods
map()
map(mapping): CellBookmark;Defined in: tables/src/cellselection/CellBookmark.ts:41
Maps this bookmark through a document transformation.
Parameters
| Parameter | Type | Description |
|---|---|---|
mapping | Mappable | The mapping describing the document change. |
Returns
CellBookmark
A new CellBookmark with updated positions.
resolve()
resolve(doc):
| CellSelection
| Selection_2;Defined in: tables/src/cellselection/CellBookmark.ts:54
Resolves this bookmark to a selection in the given document.
If both positions still point to valid cells within the same table, a CellSelection is returned. Otherwise, falls back to a nearby selection.
Parameters
| Parameter | Type | Description |
|---|---|---|
doc | Node_2 | The document to resolve positions in. |
Returns
| CellSelection | Selection_2
A CellSelection if valid, or a fallback Selection.