Skip to content

Type Editor


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

CellSelection.getBookmark

Constructors

Constructor

ts
new CellBookmark(anchor, head): CellBookmark;

Defined in: tables/src/cellselection/CellBookmark.ts:30

Creates a new CellBookmark.

Parameters

ParameterTypeDescription
anchornumberThe absolute document position of the anchor cell.
headnumberThe absolute document position of the head cell.

Returns

CellBookmark

Methods

map()

ts
map(mapping): CellBookmark;

Defined in: tables/src/cellselection/CellBookmark.ts:41

Maps this bookmark through a document transformation.

Parameters

ParameterTypeDescription
mappingMappableThe mapping describing the document change.

Returns

CellBookmark

A new CellBookmark with updated positions.


resolve()

ts
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

ParameterTypeDescription
docNode_2The document to resolve positions in.

Returns

| CellSelection | Selection_2

A CellSelection if valid, or a fallback Selection.