typeIntoEditor
Types text into a CodeMirror editor using trusted keyboard input.
Focuses the editor (caret to the end) and presses every code point of the text — the same trusted sequence a real user produces — so the text reaches the document only if the editor genuinely holds focus. Then it polls until the document reflects the input, or a bounded timeout elapses (the expected outcome when the editor is read-only or focus was stolen).
Import:
import { typeIntoEditor } from 'obsidian-dev-utils/obsidian/trusted-input';Signature:
function typeIntoEditor(params: TypeIntoEditorParams): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
params | TypeIntoEditorParams | The editor to type into and the text to type. |
Returns: Promise<void> — A Promise that resolves once the keystrokes have settled.