typeIntoEditor
Types text into a CodeMirror Editor using trusted Electron keyboard input.
This focuses the editor (caret to end) and presses every code point of text via pressKey — the same trusted sequence a real user produces — so the text reaches the document only if the editor genuinely holds focus. After injecting the keystrokes 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/desktop-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.
Links to this page: