New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.0.2

@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)

ClickPositionResolver provides fast click-to-position mapping by caching DOM element positions and using binary search.

declare class ClickPositionResolver
MemberTypeSummary
getDebugInfoGet debug info.
getElementAtPositionGet the element containing a PM position. Useful for caret positioning.
getFragmentAtPointGet the fragment at a point within a page.
getPageAtYGet the page at a Y coordinate using binary search.
getPagesGet all pages info (for debugging).
getPositionAtPointGet PM position from client coordinates. Main entry point for click-to-position mapping.
getPositionInRunGet the exact PM position within a run using binary search.
getRunAtXGet the run at an X coordinate within a fragment.
invalidateMark the index as dirty (needs rebuild).
isDirtyCheck if index needs rebuilding.
rebuildRebuild the entire index from the container. Call this after layout changes.

Interfaces(1)

Result of a position lookup.

interface PositionLookupResult
MemberTypeSummary
elementHTMLElement
pageIndexnumber
pmPositionnumber