Browser Surface API
Встраивание готовой Web Surface, mount/unmount и события хоста.
fastdoc-cli surface --port 0 --doc /absolute/input.docx --save /absolute/output.docxinterface HostConfig { theme?:"light"|"dark"; locale?:string; readOnly?:boolean; cssVariables?:Record<`--fastdoc-${string}`,string>; }interface Handle { container:HTMLElement; hostConfig:Readonly<HostConfig>; unmount():void; }interface FastDocSurface { version:"fastdoc.surface-mount.v1"; mount(container:HTMLElement, config?:HostConfig):Handle; unmount():void; }// window.fastdocSurface: FastDocSurface4.1. Host events
Заголовок раздела «4.1. Host events»type SurfaceEvent = | {schema:"fastdoc.surface-host-event.v1";type:"ready";documentPath:string;savePath:string;theme:string;locale:string} | {schema:"fastdoc.surface-host-event.v1";type:"dirty";dirty:boolean} | {schema:"fastdoc.surface-host-event.v1";type:"saved";dirty:false;path:string;byteCount:number} | {schema:"fastdoc.surface-host-event.v1";type:"error";operation:"connect"|"save";message:string} | {schema:"fastdoc.surface-host-event.v1";type:"unmounted"};window.addEventListener("fastdoc-host-event", e => consume((e as CustomEvent<SurfaceEvent>).detail));// WKWebView handler: fastdocHost; WebView2: WebMessageReceivedBounded current surface. Реализованы mount/unmount, чтение/правка первого абзаца, save/shutdown и пять событий. Произвольная структура/selection/context-menu не опубликованы.