Release RuneStone 0.1.4 with installable plugins and settings
This commit is contained in:
+27
-3
@@ -1,7 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { startExternalPlugins } from "$lib/plugins/external";
|
||||
import { onMount } from "svelte";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import Workbench from "$lib/layout/Workbench.svelte";
|
||||
import TerminalWindow from "$lib/terminal/TerminalWindow.svelte";
|
||||
import TerminalSlot from "$lib/plugins/TerminalSlot.svelte";
|
||||
import { pluginHost } from "$lib/plugins/registry";
|
||||
const terminalRoot = new URLSearchParams(location.search).get("terminalWindow");
|
||||
let dock: TerminalSlot | undefined = $state();
|
||||
let error = $state("");
|
||||
const terminal = $derived.by(() => { void $pluginHost; return pluginHost.get("terminal"); });
|
||||
onMount(startExternalPlugins);
|
||||
function keydown(event: KeyboardEvent) {
|
||||
if (!terminalRoot || event.target instanceof Element && event.target.closest("dialog, [role=menu]")) return;
|
||||
const action = terminal?.shortcut(event);
|
||||
if (action && action !== "toggle") { event.preventDefault(); void dock?.command(action).catch(reason => error = String(reason)); }
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if terminalRoot}<TerminalWindow cwd={terminalRoot} />{:else}<Workbench />{/if}
|
||||
<svelte:window onkeydown={keydown} />
|
||||
{#if terminalRoot}
|
||||
<div class="terminal-window">
|
||||
{#if error}<p role="alert">{error}</p>{/if}
|
||||
{#if terminal}
|
||||
{#key terminal}
|
||||
<TerminalSlot bind:this={dock} contribution={terminal} cwd={terminalRoot} visible standalone
|
||||
onClose={() => void getCurrentWindow().destroy().catch(reason => error = String(reason))} />
|
||||
{/key}
|
||||
{:else}<p>Install and enable the Terminal plugin in Settings → Plug-ins in the main window.</p>{/if}
|
||||
</div>
|
||||
{:else}<Workbench />{/if}
|
||||
<style>.terminal-window { height: 100vh; display: flex; flex-direction: column; }</style>
|
||||
|
||||
Reference in New Issue
Block a user