* Find the native DOM element from a Editor node.
(editor: Editor, node: Node)
| 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…