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

Function yTextToEditorElement

packages/yjs-transform/src/index.ts:7–14  ·  view source on GitHub ↗
(yText: Y.XmlText)

Source from the content-addressed store, hash-verified

5import { getProperties } from './editable'
6
7export function yTextToEditorElement<T extends Element>(yText: Y.XmlText): T {
8 const delta = yTextToInsertDelta(yText)
9
10 const children =
11 delta.length > 0 ? delta.map(deltaInsertToEditorNode) : yText.parent ? [{ text: '' }] : []
12
13 return { ...yText.getAttributes(), children } as T
14}
15
16export function deltaInsertToEditorNode<T extends Node>(insert: DeltaInsert): T {
17 if (typeof insert.insert === 'string') {

Callers 2

withYjsFunction · 0.90
deltaInsertToEditorNodeFunction · 0.85

Calls 1

yTextToInsertDeltaFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…