Skip to content

Type Editor


Type Editor / @type-editor/dom-change-util / parse-change/handle-selection-only-change / handleSelectionOnlyChange

Function: handleSelectionOnlyChange()

ts
function handleSelectionOnlyChange(view, compositionID): void;

Defined in: parse-change/handle-selection-only-change.ts:29

Handles selection-only changes (when no content has changed).

This function is called when a DOM change event indicates a selection change but no content modification. It reads the current DOM selection, creates a transaction to update the editor selection, and dispatches it.

The function also:

  • Determines the selection origin (pointer, key, or null) based on timing
  • Handles Android Chrome Enter key edge cases
  • Adds appropriate metadata to the transaction (pointer, scrollIntoView, composition)

If the new selection is identical to the current selection, no action is taken.

Parameters

ParameterTypeDescription
viewPmEditorViewThe editor view containing the DOM and current state
compositionIDnumberThe current composition ID if in composition mode (0 if not composing). This is used to track IME composition events.

Returns

void

See