Type Editor / @type-editor/tables / utils/query
utils/query
Query utilities for table cell and table node lookups.
This module provides helper functions for finding and resolving table-related positions within the editor document. It includes utilities for:
- Finding cells by position
- Finding table nodes containing a position
- Finding cell ranges for selections
Interfaces
| Interface | Description |
|---|---|
Result of finding a parent node that matches a predicate. This interface provides comprehensive information about a found node, including its position in the document and its depth in the node tree. |
Functions
| Function | Description |
|---|---|
Finds the resolved position of a table cell at or near the given document position. This function first attempts to find a cell that directly contains the position using cellAround. If no containing cell is found, it searches for a nearby cell using cellNear. Example typescript | |
Finds the anchor and head cell positions for a table cell selection. This function attempts to determine the cell range for a selection using the following strategy:
Example typescript | |
Finds the closest table node containing the given position. This function traverses up the document tree from the resolved position to find the nearest ancestor node with a Example typescript | |
Type guard to check if a value is a CellSelection instance. This function safely determines whether an unknown value is a cell selection, enabling type-safe access to cell selection properties and methods. Example typescript |