Fitter algorithm and replace helpers for fitting slices into document gaps.
Ports replace.ts from prosemirror-transform/src/replace.ts.
Summary
Functions
Smart delete that expands to cover parent nodes when appropriate.
Find a position at or around the given position where a node of the given type can be inserted. Returns nil when no position was found.
WYSIWYG-aware replace. Expands/contracts the range for best structural fit.
WYSIWYG-aware single-node replacement.
'Fit' a slice into a given position in the document, producing a step that inserts it. Will return nil if there's no meaningful way to insert the slice here, or inserting it would be a no-op.
Functions
Smart delete that expands to cover parent nodes when appropriate.
Find a position at or around the given position where a node of the given type can be inserted. Returns nil when no position was found.
WYSIWYG-aware replace. Expands/contracts the range for best structural fit.
WYSIWYG-aware single-node replacement.
'Fit' a slice into a given position in the document, producing a step that inserts it. Will return nil if there's no meaningful way to insert the slice here, or inserting it would be a no-op.