feat: 收口 mindmap Phase 6 Leptos UI shell

This commit is contained in:
lix-2026
2026-05-11 12:27:40 +08:00
parent b7dddd2a66
commit b5eb27fabc
51 changed files with 8669 additions and 1313 deletions
@@ -39,8 +39,21 @@ type IslandRuntimeModule = {
default: (input?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module) => Promise<unknown>;
mount: (container: Element, options: unknown) => number;
unmount: (mountId: number) => void;
mount_mindmap_shell?: (container: Element, options: unknown) => number;
unmount_mindmap_shell?: (mountId: number) => void;
};
type MindmapRustShellBridge = {
mount: (container: Element, options: unknown) => number;
unmount: (mountId: number) => void;
};
declare global {
interface Window {
__MNOTE_MINDMAP_RUST_SHELL__?: MindmapRustShellBridge;
}
}
type RuntimeEnvelope<T = unknown> = {
protocol?: string;
runtime?: string;
@@ -251,6 +264,15 @@ async function loadIslandRuntime(): Promise<{
throw new Error("island entry 缺少 unmount 导出");
}
await runtimeModule.default(wasmAssetUrl ?? undefined);
if (
typeof runtimeModule.mount_mindmap_shell === "function" &&
typeof runtimeModule.unmount_mindmap_shell === "function"
) {
window.__MNOTE_MINDMAP_RUST_SHELL__ = {
mount: runtimeModule.mount_mindmap_shell,
unmount: runtimeModule.unmount_mindmap_shell,
};
}
return {
runtimeModule,
entryAssetUrl,
@@ -778,9 +800,6 @@ export function LeptosTiptapIslandEditorHost(props: DocumentEditorHostProps) {
);
}
},
requestFallbackToBlockNote: () => {
requestFallback("explicit_fallback", "通过页面壳显式切回 BlockNote");
},
};
useEditorBridgeStore.getState().registerBridge(editorBridge);
return () => {