Skip to content

Editor.replaceRange method

Editor › replaceRange

Official

Replace the range between two positions.

Signature:

replaceRange(replacement: string, from: EditorPosition, to?: EditorPosition | undefined, origin?: string | undefined): void

Parameters:

ParameterTypeDescription
replacementstringThe replacement text.
fromEditorPositionThe start position.
to?EditorPosition | undefinedThe end position.
origin?string | undefinedThe user event that triggered the replacement.

Returns: void

Since: 0.11.11

Example:

editor.replaceRange('foo', from, to);