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

Method fromYPos

packages/plugins/codeblock/src/plugin/yjs/sync.ts:54–69  ·  view source on GitHub ↗

* @param rpos

(rpos: Y.RelativePosition | Object)

Source from the content-addressed store, hash-verified

52 * @param rpos
53 */
54 fromYPos(rpos: Y.RelativePosition | Object) {
55 if (!this.ytext.doc) throw new Error('Document not attached')
56 const pos = Y.createAbsolutePositionFromRelativePosition(
57 Y.createRelativePositionFromJSON(rpos),
58 this.ytext.doc,
59 )
60 if (pos == null || pos.type !== this.ytext) {
61 throw new Error(
62 '[yCodeblockPlugins]] The position you want to retrieve was created by a different document',
63 )
64 }
65 return {
66 pos: pos.index,
67 assoc: pos.assoc,
68 }
69 }
70
71 /**
72 * @param range

Callers 1

fromYRangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected