@eigenpal/docx-editor-core/prosemirror/utils/ClickPositionResolver
Click Position Resolver
Provides fast, indexed lookups for click-to-position mapping. Caches page, fragment, and run positions for O(log n) lookups instead of O(n) DOM traversal.
Classes (1)
ClickPositionResolverclassSource ↗
ClickPositionResolver provides fast click-to-position mapping by caching DOM element positions and using binary search.
declare class ClickPositionResolver| Member | Type | Summary |
|---|---|---|
| getDebugInfo | | Get debug info. |
| getElementAtPosition | | Get the element containing a PM position. Useful for caret positioning. |
| getFragmentAtPoint | | Get the fragment at a point within a page. |
| getPageAtY | | Get the page at a Y coordinate using binary search. |
| getPages | | Get all pages info (for debugging). |
| getPositionAtPoint | | Get PM position from client coordinates. Main entry point for click-to-position mapping. |
| getPositionInRun | | Get the exact PM position within a run using binary search. |
| getRunAtX | | Get the run at an X coordinate within a fragment. |
| invalidate | | Mark the index as dirty (needs rebuild). |
| isDirty | | Check if index needs rebuilding. |
| rebuild | | Rebuild the entire index from the container. Call this after layout changes. |
Interfaces (1)
PositionLookupResultinterfaceSource ↗
Result of a position lookup.
interface PositionLookupResult| Member | Type | Summary |
|---|---|---|
| element | HTMLElement | |
| pageIndex | number | |
| pmPosition | number |