diff --git a/client/codemirror/clean.ts b/client/codemirror/clean.ts index 541b64e8..935fa821 100644 --- a/client/codemirror/clean.ts +++ b/client/codemirror/clean.ts @@ -55,6 +55,12 @@ export function cleanModePlugins(client: Client) { // Propagate click event from checkbox void client.dispatchClickEvent(clickEvent); }, + onStateChange: (pos, endPos, _oldState, newState) => { + client.editorView.dispatch({ + changes: { from: pos, to: endPos, insert: newState }, + }); + }, + client, }), listBulletPlugin(), tablePlugin(client), diff --git a/client/plugos/syscalls/sync.ts b/client/plugos/syscalls/sync.ts index 353aa77b..68076a04 100644 --- a/client/plugos/syscalls/sync.ts +++ b/client/plugos/syscalls/sync.ts @@ -7,12 +7,30 @@ export function syncSyscalls(client: Client): SysCallMapping { "sync.hasInitialSyncCompleted": (): boolean => { return client.fullSyncCompleted; }, - "sync.performFileSync": (_ctx, path: string): Promise => { - void client.postServiceWorkerMessage({ type: "perform-file-sync", path }); + "sync.performFileSync": async (_ctx, path: string): Promise => { + try { + await client.postServiceWorkerMessage({ + type: "perform-file-sync", + path, + }); + } catch (e: any) { + console.warn( + "No service worker available, so sync is inactive", + e.message, + ); + return; + } return waitForServiceWorkerActivation(path); }, - "sync.performSpaceSync": (): Promise => { - void client.postServiceWorkerMessage({ type: "perform-space-sync" }); + "sync.performSpaceSync": async (): Promise => { + try { + await client.postServiceWorkerMessage({ + type: "perform-space-sync", + }); + } catch (e: any) { + console.warn("No service worker available, so sync is inactive", e); + return 0; + } return waitForServiceWorkerActivation(); }, };