MCPcopy Create free account
hub / github.com/editablejs/editable / relativePositionToEditorPoint

Function relativePositionToEditorPoint

packages/yjs-transform/src/position.ts:56–68  ·  view source on GitHub ↗
(
  sharedRoot: Y.XmlText,
  editorRoot: Node,
  pos: Y.RelativePosition,
)

Source from the content-addressed store, hash-verified

54}
55
56export function relativePositionToEditorPoint(
57 sharedRoot: Y.XmlText,
58 editorRoot: Node,
59 pos: Y.RelativePosition,
60): BasePoint | null {
61 if (!sharedRoot.doc) {
62 throw new Error("sharedRoot isn't attach to a yDoc")
63 }
64
65 const absPos = Y.createAbsolutePositionFromRelativePosition(pos, sharedRoot.doc)
66
67 return absPos && absolutePositionToEditorPoint(sharedRoot, editorRoot, absPos)
68}
69
70export function getStoredPosition(sharedRoot: Y.XmlText, key: string): Y.RelativePosition | null {
71 const rawPosition = sharedRoot.getAttribute(STORED_POSITION_PREFIX + key)

Callers 2

positionFunction · 0.90

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…