Skip to content
Document Authoring DA  API Docs v1.19.0
npmGitHub

FindNamespaceNEW

FindNamespace:

{
open(opts?: { query?: string }): void;
close(): void;
}

The Find namespace on DocAuthEditor. Lets hosts drive the editor’s Find bar programmatically — open it with a preset query, close it, or read whether it is open.

// Open the Find bar with a preset query
editor.find.open({ query: 'hello' });
// Close it programmatically
editor.find.close();
// Drive a Find button in your own chrome
const toggleFind = () => (editor.find.getState().open ? editor.find.close() : editor.find.open());

open(opts?): void

Opens the Find bar and focuses its input.

Calling open() while the bar is already open with no state delta is a no-op — it does not refocus the input.

Optional overrides for the bar’s persisted state.

  • query — preset the search text. Overrides any persisted value.

string

void


close(): void

Closes the Find bar. Match decorations are cleared. Calling close() while already closed is a no-op.

void


getState(): object

Reads the current state of the Find bar.

Use this to keep host-rendered Find affordances in sync — the bar can also be opened with Mod+F and closed from inside the bar (Escape or its close button), so a host that tracks the state itself will drift.

object

An object with open — whether the Find bar is currently shown.

open: boolean