type VditorModule = { default: new (element: HTMLElement, options: Record) => { getValue: () => string setValue: (value: string, render?: boolean) => void destroy: () => void } } interface InitializeVditorOptions { importVditor: () => Promise isUnmounted: () => boolean onReady: (ctor: VditorModule['default']) => void onError?: (error: unknown) => void } export async function initializePostBodyMarkdownEditorVditor(options: InitializeVditorOptions): Promise { try { const mod = await options.importVditor() if (options.isUnmounted()) { return } options.onReady(mod.default) } catch (error) { options.onError?.(error) } }