insertText
insertText(
editor,text,start?,end?,newCursorStart?,newCursorEnd?):void
Defined in: utils/index.ts:108
Inserts text into the editor (unless it’s read-only) while keeping undo/redo history.
Focuses the textarea if it isn’t already.
Parameters
Section titled “Parameters”editor
Section titled “editor”Target editor.
string
Text to insert.
start?
Section titled “start?”Position to start the insertion. Defaults to selectionStart.
number | null
Position to end the insertion. Defaults to start if specified, else selectionEnd.
number | null
newCursorStart?
Section titled “newCursorStart?”New starting position for the cursor. Defaults to the end of the inserted text.
number | null
newCursorEnd?
Section titled “newCursorEnd?”New ending position for the cursor. Defaults to newCursorStart.
number | null
Returns
Section titled “Returns”void