(sharedRoot: Y.XmlText, editorRoot: Node, op: InsertTextOperation)
| 3 | import type Y from 'yjs' |
| 4 | |
| 5 | export 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…