@jsvision/ui / replacePrompt
Function: replacePrompt()
replacePrompt(
host,cursor):Promise<"cancel"|"yes"|"no">
Defined in: ui/src/editor/dialogs.ts:275
Show the "replace this occurrence?" prompt (Yes / No / Cancel) used during an interactive replace. The box sits near the top of the desktop, but drops to the bottom when the caret is high enough that the box would otherwise cover it.
Parameters
host
The modal host, including its translation service.
cursor
The caret position in absolute (desktop) coordinates, used to avoid covering it.
Returns
Promise<"cancel" | "yes" | "no">
The button the user chose.
Example
ts
import { createApplication, replacePrompt } from '@jsvision/ui';
import type { EditorDialogRequest } from '@jsvision/ui';
import { resolveCapabilities } from '@jsvision/core';
const caps = resolveCapabilities().profile;
const app = createApplication({ caps });
// Inside an editorDialog handler for a 'replacePrompt' request:
const req: Extract<EditorDialogRequest, { kind: 'replacePrompt' }> = {
kind: 'replacePrompt',
cursor: { x: 10, y: 3 },
};
const answer = await replacePrompt(app, req.cursor);