Remove the special cases for the old Browser package
A browser request now needs the session token of its window. Disabling an old runestone.browser package no longer stops the engine. One list of built-in modules starts the browser and the theme editor, and the plugin menus skip their tools. The access rules no longer treat the browser ID in a special way.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { attachTooltip } from "$lib/ui/tooltip";
|
||||
import ContextMenu from "$lib/layout/ContextMenu.svelte";
|
||||
import type { MenuItem } from "$lib/layout/menuTypes";
|
||||
import { installedPlugins, pluginTools, pluginNavigation, openPluginView, runPluginCommand } from "./external";
|
||||
import { installedPlugins, isBuiltInModule, pluginTools, pluginNavigation, openPluginView, runPluginCommand } from "./external";
|
||||
// `side` places the menu below the button (the header) or at its right (the left ribbon).
|
||||
let { surface, compact = false, side = "bottom" }: { surface: "commands" | "open"; compact?: boolean; side?: "bottom" | "right" } = $props();
|
||||
let anchor = $state<HTMLButtonElement>();
|
||||
@@ -15,13 +15,13 @@
|
||||
const label = $derived(surface === "open" ? $t("Plug-in views") : $t("Commands"));
|
||||
function tooltip(node: HTMLElement) { return { destroy: attachTooltip(node, () => compact ? label : "") }; }
|
||||
const tools = $derived($pluginTools.filter(tool => tool.surface === surface
|
||||
&& tool.owner !== "runestone.browser"
|
||||
&& !isBuiltInModule(tool.owner)
|
||||
&& !(surface === "open" && tool.kind === "view" && $pluginNavigation.some(item => item.owner === tool.owner && item.id === tool.id && item.placement === "sidebar"))));
|
||||
const signature = $derived(JSON.stringify([tools, $installedPlugins.plugins.map(row => [row.manifest.id, row.manifest.name])]));
|
||||
const items: MenuItem[] = $derived.by(() => { void signature; return untrack(() => tools.map(tool => ({
|
||||
kind: "action" as const,
|
||||
label: `${tool.title} · ${$installedPlugins.plugins.find(row => row.manifest.id === tool.owner)?.manifest.name ?? tool.owner}`,
|
||||
icon: tool.icon === "list" ? "bullet" as const : tool.icon ?? (tool.owner === "runestone.browser" && tool.id === "new-tab" ? "globe" as const : tool.kind === "command" && surface === "commands" ? "code" as const : "plus" as const),
|
||||
icon: tool.icon === "list" ? "bullet" as const : tool.icon ?? (tool.kind === "command" && surface === "commands" ? "code" as const : "plus" as const),
|
||||
run: () => {
|
||||
error = "";
|
||||
if (tool.kind === "view") openPluginView(tool.owner, tool.id);
|
||||
|
||||
Reference in New Issue
Block a user