Skip to content

Type Editor


Type Editor / @type-editor/selection-util / selection-to-dom / selectionToDOM

Function: selectionToDOM()

ts
function selectionToDOM(view, force?): void;

Defined in: selection-to-dom.ts:42

Synchronizes the ProseMirror selection to the DOM.

This function updates the browser's selection to match the current ProseMirror selection state. It handles various edge cases including:

  • Node selections
  • Delayed drag selections in Chrome
  • Broken selection behavior in Safari/older Chrome
  • Cursor wrappers for special cases
  • Selection visibility

Parameters

ParameterTypeDefault valueDescription
viewPmEditorViewundefinedThe editor view to synchronize
forcebooleanfalseWhether to force the selection update even if not needed

Returns

void