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

Function toDOMNode

packages/editor/src/plugin/editable.ts:402–413  ·  view source on GitHub ↗

* Find the native DOM element from a Editor node.

(editor: Editor, node: Node)

Source from the content-addressed store, hash-verified

400 */
401
402 toDOMNode(editor: Editor, node: Node): HTMLElement {
403 const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor)
404 const offsetNode = Editor.isEditor(node)
405 ? EDITOR_TO_ELEMENT.get(editor)
406 : KEY_TO_ELEMENT?.get(Editable.findKey(editor, node))
407
408 if (!offsetNode) {
409 throw new Error(`Cannot resolve a DOM node from Editor node: ${Scrubber.stringify(node)}`)
410 }
411
412 return offsetNode
413 },
414
415 /**
416 * Find a native DOM selection point from a Editor point.

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…