Minor Changes
-
#6266
bc91dcaThanks @dylans! - Addeditor.onDOMErrorand the lookupsDOMEditor.resolveDOMPoint,DOMEditor.resolveDOMRangeandDOMEditor.resolveEventRange.The resolve lookups return
nullinstead of throwing. While the DOM is still catching up with the model (the editor isn't mounted, a render is pending, or Android input hasn't been applied yet), a missing point is ordinary and isn't reported. Once the DOM has settled, a point that still can't be found means a broken rendering contract, such as an element that doesn't render itschildren, and is reported througheditor.onDOMError, which passes it to the browser'sreportErrorby default.Slate's own handlers now use these lookups with no try/catch. ArrowUp near a trailing newline, the
beforeinputlink-end check, shift-clicking past a selected void and restoring the DOM selection no longer throw out of their handlers. Selection syncing, which used to swallow every failure, now reports only the broken-contract case.slate-react now requires slate-dom 0.141.0 or later.
-
#6265
82f6713Thanks @dylans! - Multi-line plain-text paste now builds the lines into a fragment and callseditor.insertFragmentonce, instead of splitting the block and callingeditor.insertTextfor each line. Pasting 22,000 lines runs about eight times faster.Changes plugins can see:
- Outside inlines,
insertFragmentoverrides now receive multi-line plain-text pastes, andinsertTextoverrides no longer see them. Single-line pastes still go throughinsertText. - The operations are an
insert_nodeper middle line instead of asplit_nodeper line. Code that matches operation types inapplysees the new shape. - Every pasted line gets the block properties and marks at the caret, including pending
editor.marks. - With the caret inside an inline such as a link, every line still stays inside it, as before. The first and last lines go through
insertText, and the middle lines are inserted with oneinsertNodescall instead of one split per line.
- Outside inlines,