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

Function insertText

packages/plugins/yjs/src/apply-to-yjs/text/insert-text.ts:5–14  ·  view source on GitHub ↗
(sharedRoot: Y.XmlText, editorRoot: Node, op: InsertTextOperation)

Source from the content-addressed store, hash-verified

3import type Y from 'yjs'
4
5export function insertText(sharedRoot: Y.XmlText, editorRoot: Node, op: InsertTextOperation): void {
6 const { yParent: target, textRange } = getYTarget(sharedRoot, editorRoot, op.path)
7
8 const targetNode = Node.get(editorRoot, op.path)
9 if (!Text.isText(targetNode)) {
10 throw new Error('Cannot insert text into non-text node')
11 }
12
13 target.insert(textRange.start + op.offset, op.text, getProperties(targetNode))
14}

Callers

nothing calls this directly

Calls 3

getYTargetFunction · 0.90
getPropertiesFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…