import type { ReactNode } from 'react'; import type { TFunction } from 'i18next'; import type { InsertPayload } from '../_shared/insert-result'; import type { HelpMeWriteRenderContext } from './rich-text-editor'; export type EditorExtensionContext = 'note' | 'diagnosis' | 'document' | string; export interface EditorExtensionRenderContext { html: string; text: string; selectionText: HelpMeWriteRenderContext['selectionText']; scope: HelpMeWriteRenderContext['scope']; /** Inserts at the captured selection, then closes. Image modes require an upload seam. */ insert: (payload: InsertPayload) => Promise; close: () => void; signal: AbortSignal; } export type EditorExtensionRunContext = EditorExtensionRenderContext; /** Outcomes contain no editor content or host error messages. */ export type EditorExtensionRunResult = { status: 'success'; } | { status: 'error'; } | { status: 'aborted'; }; export interface EditorExtension { id: string; /** Translated host label, or a kit translation key. */ label: string; description?: string; icon?: ReactNode; /** Absent means everywhere. Restricted entries require a matching editor context. */ contexts?: EditorExtensionContext[]; source?: { kind: 'kit' | 'marketplace'; appName?: string; appIconUrl?: string; }; kind: 'panel' | 'action'; render?: (ctx: EditorExtensionRenderContext) => ReactNode; run?: (ctx: EditorExtensionRunContext) => Promise; } /** * Resolve an extension's `label` for display. * * `label` is either a kit translation key or a string the host has already * translated, so it has to survive the round trip untouched when it is the * latter. i18next reads `:` as its namespace separator and splits any key on * it unless the key also carries a space, comma, `?`, `!` or `;` — so a host * label like `ICD-10:lookup` came back as `lookup`, the prefix silently eaten * (caught in review on #183). `nsSeparator: false` turns that parse off, and * `defaultValue` returns the label verbatim when there is no key to look up. */ export declare function resolveExtensionLabel(t: TFunction, label: string): string; //# sourceMappingURL=editor-extensions.d.ts.map