Skip to content

@jsvision/ui / wireEditorDialogs

Function: wireEditorDialogs()

wireEditorDialogs(host, opts?): EditorDialogHandler

Defined in: ui/src/editor/dialogs.ts:215

Build a complete editorDialog handler backed by the dialogs in this module — Find, Replace, the replace prompt, "not found", the save-confirmation prompts, and file-error boxes. Pass the result as an Editor's editorDialog option to make its find/replace/save prompts work out of the box.

Parameters

host

ModalDialogHost

The modal host ({ loop: app.loop, desktop: app.desktop }).

opts?

Optional hooks; provide saveAs to answer "save as" requests with a file path.

saveAs?

(name) => Promise<string | null>

Returns

EditorDialogHandler

A handler suitable for the editor's editorDialog option.

Example

ts
import { createApplication, Editor, wireEditorDialogs } from '@jsvision/ui';

const app = createApplication({ caps });
const editorDialog = wireEditorDialogs({ loop: app.loop, desktop: app.desktop });
const editor = new Editor({ editorDialog });
await editor.find(); // now opens the real Find dialog