Type Editor / @type-editor/dom-change-util / parse-change/parse-between / parseBetween
Function: parseBetween()
ts
function parseBetween(view, from_, to_): ParseBetweenResult;Defined in: parse-change/parse-between.ts:35
Parses a range of DOM content into a ProseMirror document fragment.
This function is the core of DOM change detection. It takes a range of positions in the document, finds the corresponding DOM nodes, parses them into a ProseMirror document, and attempts to reconstruct the selection state. It also applies various browser-specific workarounds during the parsing process.
The parsing process:
- Determines the DOM range to parse
- Builds position tracking for selection reconstruction
- Applies browser-specific adjustments (e.g., Chrome backspace bug)
- Parses the DOM into a ProseMirror document
- Reconstructs selection from tracked positions
Parameters
| Parameter | Type | Description |
|---|---|---|
view | PmEditorView | The editor view containing the document and DOM |
from_ | number | Start position in the ProseMirror document (absolute position) |
to_ | number | End position in the ProseMirror document (absolute position) |
Returns
Parsed document information including the parsed content, selection state, and the actual from/to positions used (which may differ from input)
See
adjustForChromeBackspaceBug for browser-specific adjustments