Skip to content

@jsvision/ui / wireEditorDialogs

Function: wireEditorDialogs() ​

wireEditorDialogs(host, opts?): EditorDialogHandler

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

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, including its translation service.

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';
import { resolveCapabilities } from '@jsvision/core';

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