Since silverbullet’s navigation is usually keyboard focused and i don’t like having to click a button everytime I want to toggle the client sync mode, I just made this basic command by copying the code from the button in editor_ui.tsx:
silverbullet.registerCommand({name: "Sync: Toggle"}, async () => {
if(client.syncMode) {
localStorage.removeItem("syncMode");
await editor.flashNotification(
"Now switching to online mode, one moment please...",
"info"
);
} else {
localStorage.setItem("syncMode", true);
await editor.flashNotification(
"Now switching to sync mode, one moment please...",
"info"
);
}
await new Promise(resolve => setTimeout(resolve, 1000));
location.reload();
});
Not really a neccessity, but it probably saves me about 1 click / month. Absolutely worth it.