From 5481e49393ddaada1f3fb2c5c132ec62f8a901f6 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 26 Jul 2023 11:22:10 +0200 Subject: [PATCH] Debug: Reload UI command --- plug-api/silverbullet-syscall/editor.ts | 4 ++++ plugs/core/core.plug.yaml | 5 +++++ plugs/core/debug.ts | 4 ++++ web/syscalls/editor.ts | 3 +++ 4 files changed, 16 insertions(+) diff --git a/plug-api/silverbullet-syscall/editor.ts b/plug-api/silverbullet-syscall/editor.ts index 693b1b03..c4cd2403 100644 --- a/plug-api/silverbullet-syscall/editor.ts +++ b/plug-api/silverbullet-syscall/editor.ts @@ -42,6 +42,10 @@ export function reloadPage(): Promise { return syscall("editor.reloadPage"); } +export function reloadUI(): Promise { + return syscall("editor.reloadUI"); +} + export function openUrl(url: string, existingWindow = false): Promise { return syscall("editor.openUrl", url, existingWindow); } diff --git a/plugs/core/core.plug.yaml b/plugs/core/core.plug.yaml index c31d0232..1cff8d9f 100644 --- a/plugs/core/core.plug.yaml +++ b/plugs/core/core.plug.yaml @@ -352,6 +352,11 @@ functions: command: name: "Debug: Parse Document" + reloadUICommand: + path: ./debug.ts:reloadUICommand + command: + name: "Debug: Reload UI" + resetClientCommand: path: ./debug.ts:resetClientCommand command: diff --git a/plugs/core/debug.ts b/plugs/core/debug.ts index 6ceddfd1..5bf02e38 100644 --- a/plugs/core/debug.ts +++ b/plugs/core/debug.ts @@ -14,3 +14,7 @@ export async function parsePageCommand() { export async function resetClientCommand() { await debug.resetClient(); } + +export async function reloadUICommand() { + await editor.reloadUI(); +} diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index adcef346..3ba6a1ce 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -42,6 +42,9 @@ export function editorSyscalls(editor: Client): SysCallMapping { "editor.reloadPage": async () => { await editor.reloadPage(); }, + "editor.reloadUI": () => { + location.reload(); + }, "editor.openUrl": (_ctx, url: string, existingWindow = false) => { if (!existingWindow) { const win = window.open(url, "_blank");