ElementDOMSlot
classA utility class for managing the DOM children of an ElementNode. Extends DOMSlot with ElementNode-specific scaffolding — the reconciler-managed line break that keeps empty elements selectable, and the offset / index resolution helpers needed when mapping DOM selections onto lexical positions. The base `before` / `after` boundaries and the children mutation helpers (`insertChild`, `removeChild`, …) live on DOMSlot.
Import
import { ElementDOMSlot } from '@modular/sdk/editor';Members10
- after
Node | nullLower boundary: the lexical-managed range starts after this node.
- before
Node | nullUpper boundary: the lexical-managed range ends before this node.
- element
TThe content-bearing element of the node's DOM.
- getFirstChild()
() => ChildNode | nullReturns the first managed child (the first node in `this.element` that is not a non-lexical prelude / decoration), or `null` if there is none. Subclasses may override to also skip reconciler-managed scaffolding such as the managed line break.
- insertChild()
(dom: Node) => thisInsert the given node before `this.before` (if defined) or append it to `this.element` otherwise. Subclasses may override to respect additional boundaries (e.g. `ElementDOMSlot` also keeps the managed line break at the end).
- removeChild()
(dom: Node) => thisRemove the given child from `this.element`. Throws if it was not a child.
- replaceChild()
(dom: Node, prevDom: Node) => thisReplace `prevDom` with `dom`. Throws if `prevDom` is not a child.
- withAfter()
(after: Node | undefined | null) => ElementDOMSlot<T>Return a new slot with `after` updated, preserving subclass type.
- withBefore()
(before: Node | undefined | null) => ElementDOMSlot<T>Return a new slot with `before` updated, preserving subclass type.
- withElement()
<ElementType extends HTMLElement>(element: ElementType) => ElementDOMSlot<ElementType>Return a new slot with `element` updated, preserving subclass type.