Skip to content

Type Editor


Type Editor / @type-editor/dom-change-util / parse-change/parse-between

parse-change/parse-between

Functions

FunctionDescription

parseBetween

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:

  1. Determines the DOM range to parse
  2. Builds position tracking for selection reconstruction
  3. Applies browser-specific adjustments (e.g., Chrome backspace bug)
  4. Parses the DOM into a ProseMirror document
  5. Reconstructs selection from tracked positions

See

adjustForChromeBackspaceBug for browser-specific adjustments