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

Function relativeRangeToEditorRange

packages/yjs-transform/src/position.ts:245–263  ·  view source on GitHub ↗
(
  sharedRoot: Y.XmlText,
  editorRoot: Node,
  range: RelativeRange,
)

Source from the content-addressed store, hash-verified

243}
244
245export function relativeRangeToEditorRange(
246 sharedRoot: Y.XmlText,
247 editorRoot: Node,
248 range: RelativeRange,
249): BaseRange | null {
250 const anchor = relativePositionToEditorPoint(sharedRoot, editorRoot, range.anchor)
251
252 if (!anchor) {
253 return null
254 }
255
256 const focus = relativePositionToEditorPoint(sharedRoot, editorRoot, range.focus)
257
258 if (!focus) {
259 return null
260 }
261
262 return { anchor, focus }
263}

Callers 2

withYCursorsFunction · 0.90
handleStackItemPoppedFunction · 0.90

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…