Skip to content

Type Editor


Type Editor / @type-editor/commands / util/find-extended-mark-selection / findExtendedMarkSelection

Function: findExtendedMarkSelection()

ts
function findExtendedMarkSelection(
  doc,
  $cursor,
  markType,
  onlyNumbers,
): ExtendedSelectionResult;

Defined in: util/find-extended-mark-selection.ts:38

Attempts to find an extended selection for an empty selection.

If the cursor is within a range that has the specified mark type, extends the selection to cover the entire contiguous marked range. This is useful for toggling marks like links where the user positions the cursor inside the linked text and expects the entire link to be toggled.

If not within a marked range, falls back to selecting a single adjacent character (first checking before, then after the cursor).

Parameters

ParameterTypeDescription
docNode_2The document node
$cursorResolvedPosThe resolved cursor position
markTypeMarkTypeThe mark type to check for range extension
onlyNumbersbooleanWhether to only select numeric characters

Returns

ExtendedSelectionResult

Information about the extended selection