Show the engine setup until the browser engine is installed

A browser tab shows the download size, Download the engine, Install from
file, and Open in default browser until the engine can start. It shows
progress, Cancel, the cause of a failure, and Retry, and then opens the
page. Settings -> Browser shows the engine state and Remove engine. Web
links open in the system browser until the engine is installed. Open
link in app browser always opens a browser tab.
This commit is contained in:
Knotty Wyvern
2026-10-29 01:18:21 -07:00
parent 6004e126f7
commit c06d48f250
19 changed files with 425 additions and 107 deletions
+15
View File
@@ -997,3 +997,18 @@ Native shell, background image, and desktop acceptance remain open.
- Evidence: `tests/smoke/layout/plainFixes.smoke.mjs` and `tests/unit/layout/settings.spec.ts`.
- Replaces / replaced by: The OK and Cancel close prompt, and `white-space: pre-line` for every Read paragraph.
- Limits: The word count splits on spaces and counts each Han, Hiragana, and Katakana character as one word. The close prompt uses the native dialog, which browser checks mock. The table control area keeps its 26-pixel padding, because the drag handles need it. The drag handles still show only on hover: showing every row and column handle on focus was too busy. The line break setting applies to Read. The table preview and cell editors of Write keep each line break, because their editing depends on it.
### UI-054 — The browser engine as a separate download
- Type: Rule change
- Date: 2026-10-29
- Status: Implemented for user review
- Decision source: The owner decision "Built-in browser: optional download, installed on first use" of 2026-10-27, and Phase 6 decisions 4 and 5 of 2026-10-29.
- Previous rule: Each installer included the browser engine. A browser tab, Settings → Browser, and the browser bookmarks started the engine as soon as they opened. A web link opened in the app browser when **Open web links in RuneStone** was on. "Open link in app browser" failed when that setting was off.
- New rule: Until the engine is installed, a browser tab shows the engine setup: the download size, **Download the engine** as the primary action, **Install from file…**, and **Open in default browser** when the tab has a web address. A download shows its progress and Cancel. A failure shows its cause in the error color and **Retry**. When the engine is installed, the same tab opens its page. Settings → Browser starts with a **Browser engine** section: the state, the version, and **Remove engine** in the error color with a confirmation. The other browser settings and the browser bookmarks show after the engine is installed. Web links in documents open in the system browser until the engine is installed. "Open link in app browser" always opens an app browser tab, with the engine setup if necessary.
- Reason: A large download needs the user's consent and a clear size. A link must never wait for a download that the user did not start. The explicit command must do what its label says.
- Scope: Browser tabs, browser windows, Settings → Browser, the browser bookmarks, and web links in documents.
- Shared implementation: `src/lib/browser/engine.ts`, `EngineSetup.svelte`, `BrowserTab.svelte`, and `src-tauri/src/browser_engine.rs`.
- Evidence: `tests/smoke/browser/engine.smoke.mjs`, with screenshots of each state in both themes and a 360-pixel Settings window.
- Replaces / replaced by: The bundled engine.
- Limits: The download does not resume. A failed download starts again from zero. The engine installs for the current Windows account only. Browser checks mock the native download.
+1 -1
View File
@@ -388,7 +388,7 @@ Only one enabled plugin can own each key. The host removes contributions before
| --- | --- | --- |
| `terminal` | Mounts terminal controls in a host element. Returns update, command, and dispose functions. | Terminal plugin |
| `git` | Supplies line blame for the editor. | Git plugin |
| `browser` | The built-in browser. | RuneStone |
| `browser` | The built-in browser. `newTab(url?)` opens a browser tab. `open(url)` returns false when the system browser must open a web link, for example before the engine is installed. | RuneStone |
A terminal contribution must stop its controls and native sessions before its cleanup finishes.
+9 -2
View File
@@ -207,12 +207,19 @@ Reopen a document to update its editor tooltips after a language change.
## Use the built-in browser
RuneStone includes a Chromium-based browser. It needs no plugin.
RuneStone includes a Chromium-based browser. It needs no plugin, but its engine is a separate download of about 160 MB.
1. Select the globe button in the left ribbon to open a **New browser tab**.
2. Type an address or a search.
2. The first time, select **Download the engine**. RuneStone downloads the engine, makes sure that it is complete, and opens the page.
3. Type an address or a search.
Without internet access, select **Install from file…** and choose the engine ZIP for your RuneStone version.
If a download fails, the tab shows the cause. Select **Retry** to start the download again.
Until the engine is installed, web links in your documents open in your system browser.
After a RuneStone update that needs a new engine, a browser tab offers **Update the engine**.
Use **Settings → Browser** to set the homepage and search engine, manage profiles, block ads, and clear cookies, cache, or history.
**Settings → Browser → Browser engine** shows the installed version. **Remove engine** frees the disk space. Your profiles, bookmarks, and history stay.
Each profile keeps its own cookies and bookmarks. Web bookmarks show in the Bookmarks pane.
To open web links from your documents in your system browser instead, turn off **Open web links in RuneStone**.
+3 -1
View File
@@ -16,9 +16,11 @@ export interface TerminalMount {
export interface Contributions {
git: { blame(path: string, line: number): Promise<GitLineInfo | null> };
browser: {
newTab?(): Promise<void>;
/** Opens a browser tab, with `url` when it is given. */
newTab?(url?: string): Promise<void>;
mountSettings(container: HTMLElement): Dispose | Promise<Dispose>;
mountBookmarks(container: HTMLElement): Dispose | Promise<Dispose>;
/** Opens a web link from a document. False means that the system browser opens it. */
open(url: string): Promise<boolean>;
};
terminal: {
+14 -5
View File
@@ -1,21 +1,30 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { onMount } from 'svelte';
import Icon from '$lib/ui/Icon.svelte';
import IconButton from '$lib/ui/IconButton.svelte';
import { state as browserState, request } from './client';
import { engine, engineReady } from './engine';
let { open }: { open: (profileId: string, url: string) => Promise<void> } = $props();
let error = $state('');
onMount(() => { void request('state').catch(reason => error = String(reason)); });
// The bookmarks live in the engine. A missing engine is not started here.
const installed = $derived(engineReady($engine));
let loaded = false;
$effect(() => {
if (!installed) { loaded = false; return; }
if (loaded) return;
loaded = true;
void request('state').catch(reason => error = String(reason));
});
</script>
<div class="bookmarks">
{#if error}<p role="alert">{error}</p>{/if}
{#each $browserState?.bookmarks || [] as item (item.id)}
{#if !installed}<p class="note">{$t("Install the browser engine to see the browser bookmarks.")}</p>{/if}
{#if error}<p class="error" role="alert">{error}</p>{/if}
{#each installed ? $browserState?.bookmarks || [] : [] as item (item.id)}
<div class="row"><button class="link" title={item.url} onclick={() => void open(item.profileId, item.url)}><Icon icon="globe" /><span>{item.title}</span></button><IconButton icon="close" label={`Remove ${item.title}`} onclick={() => void request('removeBookmark', { id: item.id })} /></div>
{/each}
</div>
<style>
.bookmarks{color:var(--rs-text);font-family:var(--rs-font-ui)}.row{display:flex;align-items:center;padding:0 5px;border-radius:var(--rs-control-radius)}.row:hover{background:var(--rs-bg-active)}
.link{display:flex;align-items:center;gap:8px;flex:1;min-width:0;padding:7px 5px;border:0;border-radius:var(--rs-control-radius);color:inherit;background:transparent;text-align:left;cursor:pointer}
span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link:focus-visible{outline:2px solid var(--rs-focus)}p{color:var(--rs-error);padding:8px;font-size:12px}
span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link:focus-visible{outline:2px solid var(--rs-focus)}p{padding:8px;font-size:12px}.error{color:var(--rs-error)}.note{margin:0;color:var(--rs-text-dim)}
</style>
+2 -1
View File
@@ -9,6 +9,7 @@
import { showActionMenu } from '$lib/ui/managedActionMenu';
import { WheelQueue } from './inputQueue';
import { TabSession, type TabStatus } from './tabSession';
import { engine } from './engine';
import { AutoScroll } from './autoScroll';
let { initial, onSessionChange, newTab }: { initial: { tabId?: string; profileId?: string; url?: string }; onSessionChange: (value: TabStatus) => void; newTab: (profileId: string, url?: string) => Promise<void> } = $props();
let status = $state<TabStatus>({ tabId: '', phase: 'connecting', message: $t('Opening browser…') });
@@ -269,7 +270,7 @@
<details class="diagnostics"><summary>{$t("Browser error details")}</summary><dl>
<dt>{$t("Operation")}</dt><dd>{status.detail.operation}</dd><dt>{$t("Reason")}</dt><dd>{status.detail.reason}</dd>
<dt>{$t("Tab")}</dt><dd>{status.detail.tabId || $t('Not created')}</dd><dt>{$t("Time")}</dt><dd>{status.detail.time}</dd>
<dt>{$t("Browser")}</dt><dd>{$t("Included with RuneStone")}</dd>
<dt>{$t("Engine")}</dt><dd>{$engine?.version ?? ''}</dd>
</dl></details>
{/if}
{#if openingError || $pageErrors[tabId]}<p class="error" role="alert">{openingError || $pageErrors[tabId]}</p>{/if}
+17
View File
@@ -0,0 +1,17 @@
<script lang="ts">
import type { ComponentProps } from "svelte";
import Browser from "./Browser.svelte";
import EngineSetup from "./EngineSetup.svelte";
import { engine, engineReady } from "./engine";
// A browser tab shows the engine setup until the engine can start. Then it opens the page.
let props: ComponentProps<typeof Browser> = $props();
let browser = $state<ReturnType<typeof Browser>>();
export async function find() { await browser?.find(); }
export function detach() { browser?.detach(); }
export async function action(command: string, args: Record<string, unknown> = {}) { await browser?.action(command, args); }
</script>
{#if engineReady($engine)}
<Browser bind:this={browser} {...props} />
{:else}
<EngineSetup variant="tab" url={props.initial.url} />
{/if}
+78
View File
@@ -0,0 +1,78 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { confirm } from "@tauri-apps/plugin-dialog";
import { openUrl } from "@tauri-apps/plugin-opener";
import Icon from "$lib/ui/Icon.svelte";
import { engine, installEngine, installEngineFile, cancelEngine, removeEngine, megabytes } from "./engine";
// `tab` fills a browser tab while the engine is missing. `settings` is the Engine section of Settings → Browser.
let { variant, url = "" }: { variant: "tab" | "settings"; url?: string } = $props();
let failure = $state("");
const status = $derived($engine);
const phase = $derived(status?.state ?? "missing");
const busy = $derived(phase === "downloading" || phase === "installing");
const error = $derived(failure || status?.error || "");
const web = $derived(variant === "tab" && /^https?:\/\//i.test(url));
async function run(action: () => Promise<unknown>) {
failure = "";
try { await action(); } catch (reason) { failure = String(reason); }
}
async function remove() {
const accepted = await confirm($t("Remove the browser engine? Open browser tabs close. Your profiles, bookmarks, and history stay."), { title: $t("Remove browser engine"), kind: "warning", okLabel: $t("Remove"), cancelLabel: $t("Cancel") });
if (accepted) await run(removeEngine);
}
</script>
<section class="engine {variant}" aria-labelledby={`engine-${variant}`} data-engine-state={phase}>
{#if variant === "tab"}<span class="mark"><Icon icon="globe" /></span>{/if}
<h3 id={`engine-${variant}`}>{$t("Browser engine")}</h3>
{#if phase === "installed"}
<p>{$t("Version {version} is installed.", { version: status?.version ?? "" })}</p>
{:else if phase === "development"}
<p>{$t("This development build uses the engine in src-tauri/browser-engine.")}</p>
{:else if phase === "unavailable"}
<p>{$t("No browser engine is available for this platform yet.")}</p>
{:else if phase === "downloading"}
<p role="status">{$t("Downloading the browser engine: {received} of {total}.", { received: megabytes(status?.received ?? 0), total: megabytes(status?.bytes ?? 0) })}</p>
<progress max={status?.bytes || 1} value={status?.received ?? 0} aria-label={$t("Download progress")}></progress>
{:else if phase === "installing"}
<p role="status">{$t("Installing the browser engine…")}</p>
<progress aria-label={$t("Installation progress")}></progress>
{:else if phase === "update"}
<p>{$t("This RuneStone version needs browser engine {version}. The download is {size}.", { version: status?.version ?? "", size: megabytes(status?.bytes ?? 0) })}</p>
{:else}
<p>{$t("The built-in browser needs its engine. The engine is a separate download of {size}.", { size: megabytes(status?.bytes ?? 0) })}</p>
{/if}
{#if error && !busy}<p class="error" role="alert"><Icon icon="alert" /><span>{$t("The browser engine could not be installed: {reason}", { reason: error })}</span></p>{/if}
<div class="actions">
{#if busy}
<button type="button" disabled={phase === "installing"} onclick={() => void run(cancelEngine)}><Icon icon="close" />{$t("Cancel")}</button>
{:else if phase === "missing" || phase === "update"}
<button type="button" class="primary" onclick={() => void run(installEngine)}><Icon icon={error ? "refresh" : "download"} />{error ? $t("Retry") : phase === "update" ? $t("Update the engine") : $t("Download the engine")}</button>
<button type="button" onclick={() => void run(installEngineFile)}><Icon icon="folder-open" />{$t("Install from file…")}</button>
{:else if phase === "installed" && variant === "settings"}
<button type="button" class="danger" onclick={() => void remove()}><Icon icon="trash" />{$t("Remove engine")}</button>
{/if}
{#if web}<button type="button" onclick={() => void run(() => openUrl(url))}><Icon icon="globe" />{$t("Open in default browser")}</button>{/if}
</div>
</section>
<style>
.engine { color: var(--rs-text); font-family: var(--rs-font-ui); }
.engine.tab { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; min-height: 200px; padding: 24px 16px; text-align: center; background: var(--rs-bg); }
.engine.settings { padding: var(--rs-settings-row-padding); background: var(--rs-bg-elevated); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); }
.mark { display: grid; place-items: center; width: 48px; height: 48px; color: var(--rs-accent); }
.mark :global(svg) { width: 40px; height: 40px; }
h3 { margin: 0 0 4px; font-size: 14px; font-weight: 500; color: var(--rs-text-strong); }
.tab h3 { font-size: var(--rs-settings-heading-size); }
p { margin: 4px 0; max-width: 60ch; color: var(--rs-text); font-size: var(--rs-settings-description-size); line-height: 1.6; }
.error { display: flex; align-items: flex-start; gap: 6px; color: var(--rs-error); text-align: left; }
.error :global(svg) { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.error span { overflow-wrap: anywhere; }
progress { width: min(320px, 100%); height: 8px; accent-color: var(--rs-accent); }
.actions { display: flex; flex-wrap: wrap; justify-content: inherit; gap: 8px; margin-top: 8px; }
.tab .actions { justify-content: center; }
button { display: inline-flex; align-items: center; gap: 7px; min-height: var(--rs-settings-control-height); padding: 4px 10px; border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); background: var(--rs-bg-elevated); color: var(--rs-text); font: inherit; cursor: pointer; }
button:hover:not(:disabled) { background: var(--rs-bg-active); }
button:focus-visible { outline: 2px solid var(--rs-focus); outline-offset: 1px; }
button:disabled { color: var(--rs-text-dim); cursor: default; }
button.primary, button.primary:hover { border-color: var(--rs-accent); background: var(--rs-accent); color: var(--rs-on-accent); }
button.danger { border-color: var(--rs-error); color: var(--rs-error); }
</style>
+21 -6
View File
@@ -1,10 +1,12 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { onMount, onDestroy } from 'svelte';
import { onDestroy } from 'svelte';
import Icon from '$lib/ui/Icon.svelte';
import { showActionMenu } from '$lib/ui/managedActionMenu';
import WebData from './WebData.svelte';
import EngineSetup from './EngineSetup.svelte';
import { state as browserState, request } from './client';
import { engine, engineReady } from './engine';
let selected = $state('user'), name = $state(''), message = $state('');
let search = $state('duckduckgo'), adblock = $state(true), internalLinks = $state(true), rules = $state('');
let homepage = $state(''), filterLists = $state(''), ready = $state(false), busy = $state(false);
@@ -21,11 +23,19 @@
radio: true, checked: choice.id === (profile ? selected : search),
run: () => { if (profile) selected = choice.id; else { search = choice.id; void save(); } } })) }).close;
}
onMount(() => { void request('state').then(value => {
selected = value.profiles[0].id; search = value.settings.search; adblock = value.settings.adblock;
internalLinks = value.settings.linkDestination === 'internal'; rules = value.settings.personalRules;
homepage = value.settings.homepage || ''; filterLists = (value.settings.filterLists || []).join('\n'); ready = true;
}).catch(error => message = String(error)); });
// The browser settings live in the engine, so they load when the engine can start.
const installed = $derived(engineReady($engine));
let loading = false;
$effect(() => {
if (!installed) { ready = false; loading = false; return; }
if (loading) return;
loading = true;
void request('state').then(value => {
selected = value.profiles[0].id; search = value.settings.search; adblock = value.settings.adblock;
internalLinks = value.settings.linkDestination === 'internal'; rules = value.settings.personalRules;
homepage = value.settings.homepage || ''; filterLists = (value.settings.filterLists || []).join('\n'); ready = true;
}).catch(error => message = String(error));
});
async function act(command: string, args: Record<string, unknown>) {
try { const next = await request(command, args); message = $t('Changes saved.'); return next; } catch (error) { message = String(error); return null; }
}
@@ -50,6 +60,10 @@
</script>
<div class="settings">
<h2>{$t("Browser")}</h2><p>{$t("Choose how you browse within RuneStone.")}</p>
<EngineSetup variant="settings" />
{#if !installed}
<p class="note">{$t("The other browser settings show after the engine is installed.")}</p>
{:else}
<h3>{$t("General")}</h3>
<fieldset disabled={!ready} onchange={() => void save()}>
<div class="card">
@@ -72,6 +86,7 @@
<div class="actions"><button onclick={() => void act('clearData', { profileId: selected, kind: 'cache' })}>{$t("Clear cache")}</button><button onclick={() => void act('clearData', { profileId: selected, kind: 'cookies' })}>{$t("Clear cookies")}</button><button onclick={() => void act('clearData', { profileId: selected, kind: 'history' })}>{$t("Clear history")}</button></div>
<p role="status">{message}</p>
{#if ready}<WebData profileId={selected} />{/if}
{/if}
</div>
<style>
.settings{color:var(--rs-text);font-family:var(--rs-font-ui)}h2{margin:0;font-size:var(--rs-settings-heading-size);font-weight:500;color:var(--rs-text-strong)}h3{margin:var(--rs-settings-section-gap) 0 var(--rs-settings-gap);font-size:14px;font-weight:500}
+28
View File
@@ -0,0 +1,28 @@
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
import { writable } from 'svelte/store';
import { tr } from '../i18n/index.ts';
/** The engine states of `browser_engine_status`. See src-tauri/src/browser_engine.rs. */
export type EngineStatus = {
state: 'installed' | 'missing' | 'update' | 'downloading' | 'installing' | 'unavailable' | 'development';
version: string; bytes: number; received: number; error: string | null;
};
export const engine = writable<EngineStatus | null>(null);
/** True when the engine can start: the pinned version is installed, or a development engine is staged. */
export const engineReady = (status: EngineStatus | null) => status?.state === 'installed' || status?.state === 'development';
const update = (status: EngineStatus) => { engine.set(status); return status; };
/** Follow the engine status in this window. A failed status request reports the engine as unavailable. */
export async function watchEngine(signal: AbortSignal) {
const off = await listen<EngineStatus>('browser-engine', ({ payload }) => { if (!signal.aborted) engine.set(payload); });
try { update(await invoke<EngineStatus>('browser_engine_status')); }
catch (error) { update({ state: 'unavailable', version: '', bytes: 0, received: 0, error: String(error) }); }
return () => { off(); engine.set(null); };
}
export const installEngine = () => invoke<EngineStatus>('browser_engine_install').then(update);
export const installEngineFile = () => invoke<EngineStatus>('browser_engine_install_file').then(update);
export const cancelEngine = () => invoke<EngineStatus>('browser_engine_cancel').then(update);
export const removeEngine = () => invoke<EngineStatus>('browser_engine_remove').then(update);
/** A download size in megabytes, such as "161 MB". */
export const megabytes = (bytes: number) => tr('{size} MB', { size: Math.max(bytes ? 1 : 0, Math.round(bytes / 1_000_000)) });
+8 -3
View File
@@ -4,16 +4,18 @@ import { mount, unmount } from 'svelte';
import { get } from 'svelte/store';
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import type { PluginApi, PluginViewOpenOptions } from '$lib/plugins/sdk';
import Browser from './Browser.svelte';
import BrowserTab from './BrowserTab.svelte';
import Settings from './Settings.svelte';
import Bookmarks from './Bookmarks.svelte';
import { connect, request, state } from './client';
import { engine, engineReady, watchEngine } from './engine';
import type { TabStatus } from './tabSession';
type BrowserControl = { find(): Promise<void>; detach(): void; action(command: string, args?: Record<string, unknown>): Promise<void> };
type SavedView = { view: string; profileId?: string; url?: string; runtimeId: string; status?: TabStatus; control?: BrowserControl };
export async function activate(api: PluginApi) {
const offEngine = await watchEngine(api.signal); api.onDispose(offEngine);
const dispose = await connect(api.signal); api.onDispose(dispose);
const owners = new Map<string, SavedView>();
const offMove = await getCurrentWebviewWindow().listen<{ tabId: string }>('browser-tab-moved', ({ payload }) => {
@@ -72,7 +74,7 @@ export async function activate(api: PluginApi) {
];
}, mount: container => {
let runtimeId = '';
const instance = mount(Browser, { target: container, props: {
const instance = mount(BrowserTab, { target: container, props: {
initial: { tabId, profileId: saved.profileId, url: saved.url },
onSessionChange: value => {
saved.status = value;
@@ -97,10 +99,13 @@ export async function activate(api: PluginApi) {
}
api.registerCommand({ id: 'new-tab', title: 'New browser tab', category: 'open', icon: 'globe', run: () => open() });
api.contribute('browser', {
newTab: () => open(),
// A new tab shows the engine setup when the engine is missing.
newTab: url => open(undefined, url),
mountSettings: container => retain(mount(Settings, { target: container })),
mountBookmarks: container => retain(mount(Bookmarks, { target: container, props: { open } })),
// A web link never starts a download. Without an engine, the link opens in the system browser.
open: async url => {
if (!engineReady(get(engine))) return false;
const value = await request('state');
if (value.settings.linkDestination === 'external') return false;
await open(undefined, url); return true;
+21 -1
View File
@@ -3309,7 +3309,6 @@ export const messageRows: [string, string, string, string][] = [
["Enter a relative workspace path without reserved characters.", "Saisissez un chemin relatif dans l’espace de travail, sans caractères réservés.", "予約文字を含まないワークスペースの相対パスを入力してください。", "请输入不含保留字符的工作区相对路径。"],
["Open a workspace before renaming a document.", "Ouvrez un espace de travail avant de renommer un document.", "ドキュメント名を変更する前にワークスペースを開いてください。", "重命名文档前,请先打开工作区。"],
["The workspace changed. Reopen the document.", "L’espace de travail a changé. Rouvrez le document.", "ワークスペースが変更されました。ドキュメントを開き直してください。", "工作区已更改。请重新打开文档。"],
["Could not open the app browser.", "Impossible d’ouvrir le navigateur de l’application.", "アプリのブラウザーを開けませんでした。", "无法打开应用内浏览器。"],
["Could not add the word to the dictionary.", "Impossible d’ajouter le mot au dictionnaire.", "単語を辞書に追加できませんでした。", "无法将该词添加到词典。"],
["Copied workspace paths", "Chemins dans l’espace de travail copiés", "ワークスペースのパスをコピーしました", "已复制工作区路径"],
["Copied system paths", "Chemins système copiés", "システムのパスをコピーしました", "已复制系统路径"],
@@ -3423,6 +3422,27 @@ export const messageRows: [string, string, string, string][] = [
["Install, keep disabled", "Installer, laisser désactivé", "インストールして無効のままにする", "安装,保持停用"],
["Keep line breaks", "Conserver les sauts de ligne", "改行を保持", "保留换行"],
["Show each line break of the source in Read. When this is off, Read joins the lines of a paragraph, as CommonMark does.", "Afficher chaque saut de ligne de la source en lecture. Désactivé, la lecture joint les lignes d’un paragraphe, comme CommonMark.", "閲覧でソースの各改行を表示します。オフにすると、CommonMark と同様に段落内の行を連結します。", "在阅读中显示源文本的每个换行。关闭后,阅读会像 CommonMark 一样合并段落中的各行。"],
["{size} MB", "{size} Mo", "{size} MB", "{size} MB"],
["Browser engine", "Moteur du navigateur", "ブラウザーエンジン", "浏览器引擎"],
["Version {version} is installed.", "La version {version} est installée.", "バージョン {version} がインストールされています。", "已安装版本 {version}。"],
["This development build uses the engine in src-tauri/browser-engine.", "Cette version de développement utilise le moteur de src-tauri/browser-engine.", "この開発ビルドは src-tauri/browser-engine のエンジンを使用します。", "此开发版本使用 src-tauri/browser-engine 中的引擎。"],
["No browser engine is available for this platform yet.", "Aucun moteur de navigateur n’est encore disponible pour cette plateforme.", "このプラットフォーム向けのブラウザーエンジンはまだありません。", "此平台尚无可用的浏览器引擎。"],
["Downloading the browser engine: {received} of {total}.", "Téléchargement du moteur du navigateur : {received} sur {total}.", "ブラウザーエンジンをダウンロードしています: {received} / {total}。", "正在下载浏览器引擎:{received} / {total}。"],
["Download progress", "Progression du téléchargement", "ダウンロードの進行状況", "下载进度"],
["Installing the browser engine…", "Installation du moteur du navigateur…", "ブラウザーエンジンをインストールしています…", "正在安装浏览器引擎…"],
["Installation progress", "Progression de l’installation", "インストールの進行状況", "安装进度"],
["This RuneStone version needs browser engine {version}. The download is {size}.", "Cette version de RuneStone nécessite le moteur de navigateur {version}. Le téléchargement fait {size}.", "この RuneStone のバージョンにはブラウザーエンジン {version} が必要です。ダウンロードサイズは {size} です。", "此版本的 RuneStone 需要浏览器引擎 {version}。下载大小为 {size}。"],
["The built-in browser needs its engine. The engine is a separate download of {size}.", "Le navigateur intégré a besoin de son moteur. Le moteur est un téléchargement séparé de {size}.", "内蔵ブラウザーにはエンジンが必要です。エンジンは {size} の別ダウンロードです。", "内置浏览器需要其引擎。引擎需单独下载,大小为 {size}。"],
["The browser engine could not be installed: {reason}", "Impossible d’installer le moteur du navigateur : {reason}", "ブラウザーエンジンをインストールできませんでした: {reason}", "无法安装浏览器引擎:{reason}"],
["Update the engine", "Mettre à jour le moteur", "エンジンを更新", "更新引擎"],
["Download the engine", "Télécharger le moteur", "エンジンをダウンロード", "下载引擎"],
["Install from file…", "Installer depuis un fichier…", "ファイルからインストール…", "从文件安装…"],
["Remove engine", "Supprimer le moteur", "エンジンを削除", "移除引擎"],
["Remove the browser engine? Open browser tabs close. Your profiles, bookmarks, and history stay.", "Supprimer le moteur du navigateur ? Les onglets de navigateur ouverts se ferment. Vos profils, signets et historique restent.", "ブラウザーエンジンを削除しますか?開いているブラウザータブは閉じます。プロファイル、ブックマーク、履歴は残ります。", "要移除浏览器引擎吗?打开的浏览器标签页将关闭。您的配置文件、书签和历史记录将保留。"],
["Remove browser engine", "Supprimer le moteur du navigateur", "ブラウザーエンジンを削除", "移除浏览器引擎"],
["Install the browser engine to see the browser bookmarks.", "Installez le moteur du navigateur pour voir les signets du navigateur.", "ブラウザーのブックマークを表示するには、ブラウザーエンジンをインストールしてください。", "安装浏览器引擎后即可查看浏览器书签。"],
["The other browser settings show after the engine is installed.", "Les autres paramètres du navigateur s’affichent une fois le moteur installé.", "その他のブラウザー設定は、エンジンのインストール後に表示されます。", "安装引擎后将显示其他浏览器设置。"],
["Engine", "Moteur", "エンジン", "引擎"],
];
export const catalogs: Record<Exclude<Locale, 'en'>, Record<string, string>> = {
fr: Object.fromEntries(messageRows.map(row => [row[0], row[1]])),
+2 -1
View File
@@ -1376,7 +1376,8 @@
onRenameTitle={renameNoteTitle}
tableActions={(pane) => ({ onSearch: searchSelection, onExtract: (markdown, label, valid) => extractSelection(markdown, label, valid, pane.buffer) })}
linkActions={(pane) => ({
browser: browserContribution ? async target => { if (!await browserContribution?.open(target)) throw new Error($t("Could not open the app browser.")); } : undefined,
// "Open link in app browser" always opens a browser tab. Without an engine, the tab shows the engine setup.
browser: browserContribution?.newTab ? async target => { await browserContribution?.newTab?.(target); } : undefined,
defaultBrowser: target => openUrl(target),
workspaceItems: link => workspaceLinkItems(link, pane.buffer?.relPath ?? "", pane.id),
})}
+2
View File
@@ -142,6 +142,8 @@
{:else if icon === "plus"}
<path d="M12 5v14" />
<path d="M5 12h14" />
{:else if icon === "download"}
<path d="M12 4v11" /><path d="M7 10l5 5 5-5" /><path d="M5 20h14" />
{/if}
</svg>
<style>
+2 -1
View File
@@ -53,7 +53,8 @@
| "book-open"
| "close"
| "trash"
| "plus";
| "plus"
| "download";
type Props = {
icon: IconName;
+4 -1
View File
@@ -96,7 +96,8 @@ export async function chooseView(scope, name) {
* `test` is also `window.__TEST__`: `{ state, calls, emit(event, payload), label, workspace(options), settings(section), writeSettings(section, value) }`.
* A command without a handler throws "Unhandled IPC", or returns null when `strict` is false.
*
* Default handlers serve the settings file (`settings_*`) and tab transfers (`tab_transfer_*`). `commands` can replace them.
* Default handlers serve the settings file (`settings_*`), tab transfers (`tab_transfer_*`), and an installed browser engine
* (`browser_engine_status`). `commands` can replace them.
* All pages of one browser context share their state: the settings file and the offers are in localStorage under
* test keys, and a BroadcastChannel sends `settings-changed` to every page and `tab-transfer-accepted` to the source page.
* Without a settings file, the app migrates the old localStorage keys, so a test can seed preferences there before the first load.
@@ -219,6 +220,8 @@ function installMock(options, commands) {
const saveOffers = list => localStorage.setItem(TRANSFERS, JSON.stringify(list));
const expired = "This tab transfer expired. Drag the tab again.";
const defaults = {
// src-tauri/src/browser_engine.rs. Tests of the engine setup replace it.
browser_engine_status: () => ({ state: "installed", version: "0.1.8", bytes: 160612374, received: 0, error: null }),
settings_read: () => snapshot(),
settings_migrate: ({ sections }) => {
if (!settingsFile()) localStorage.setItem(SETTINGS_FILE, JSON.stringify({ schema: 1, revision: 1, ...sections }));
+112
View File
@@ -0,0 +1,112 @@
// The browser engine as a separate download: links without an engine, the setup panel in a tab, progress, cancel,
// failure and retry, the switch to the page, and Settings → Browser → Browser engine, in both themes and a narrow window.
import assert from 'node:assert/strict';
import path from 'node:path';
import { mockTauri, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
await runSmoke('browser/engine', async ({ page }) => {
await mockTauri(page, {
commands: test => {
const status = { state: 'missing', version: '0.1.8', bytes: 160612374, received: 0, error: null };
const snapshot = { profiles: [{ id: 'user', name: 'User' }], tabs: [], bookmarks: [], settings: { search: 'duckduckgo', adblock: true, linkDestination: 'internal', personalRules: '', homepage: '', filterLists: [] } };
let next = 0;
Object.assign(test, { status, opened: [], requests: [], confirms: [] });
const copy = () => structuredClone(status);
test.setEngine = value => { Object.assign(status, value); test.emit('browser-engine', copy()); };
return {
workspace_last_path: () => null,
'plugin:window|is_maximized': () => false,
plugins_snapshot: () => ({ root: 'test', plugins: [] }),
browser_connect: () => 'engine-session',
browser_stop: () => null,
browser_engine_status: copy,
browser_engine_install: () => { Object.assign(status, { state: 'downloading', received: 0, error: null }); return copy(); },
browser_engine_install_file: copy,
browser_engine_cancel: () => { Object.assign(status, { state: 'missing', received: 0 }); return copy(); },
browser_engine_remove: () => { Object.assign(status, { state: 'missing' }); return copy(); },
'plugin:opener|open_url': ({ url }) => { test.opened.push(url); return null; },
'plugin:dialog|message': ({ message }) => { test.confirms.push(message); return 'Remove'; },
browser_request: ({ session, command, args }) => {
if (session !== 'engine-session') throw Error('Missing browser session');
if (status.state !== 'installed') throw Error('The browser engine is not installed.');
test.requests.push(command);
if (command === 'newTab') { const tabId = 'native-' + (++next); snapshot.tabs.push({ id: tabId, profileId: 'user', url: args.url || 'about:blank', title: 'Browser', loading: false, blocked: 0, canBack: false, canForward: false }); return { tabId }; }
if (command === 'closeTab') snapshot.tabs = snapshot.tabs.filter(tab => tab.id !== args.tabId);
if (command === 'webData') return { profileId: args.profileId, cookies: [], history: [] };
return structuredClone(snapshot);
},
};
},
});
const output = await outputDir('browser/engine');
const shots = async name => {
for (const mode of ['dark', 'light']) {
await page.evaluate(async mode => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); saveAppearance({ theme: 'default', mode }); }, mode);
await page.screenshot({ path: path.join(output, `${name}-${mode}.png`) });
}
};
const panel = page.locator('.engine.tab');
await page.goto(smokeUrl);
// The welcome page shows this button when the browser contribution exists.
await page.getByRole('button', { name: 'Open browser', exact: true }).waitFor();
// A web link without an engine goes to the system browser. The contribution reports that it did not open the link.
assert.equal(await page.evaluate(async () => (await import('/src/lib/plugins/registry.ts')).pluginHost.get('browser').open('https://example.com/link')), false);
assert.deepEqual(await page.evaluate(() => window.__TEST__.requests), [], 'A link does not start the engine.');
// "Open link in app browser" opens a tab with the setup panel and a way out to the system browser.
await page.evaluate(async () => (await import('/src/lib/plugins/registry.ts')).pluginHost.get('browser').newTab('https://example.com/docs'));
await panel.waitFor();
assert.equal(await panel.getAttribute('data-engine-state'), 'missing');
await panel.getByText('The engine is a separate download of 161 MB.', { exact: false }).waitFor();
await panel.getByRole('button', { name: 'Open in default browser' }).click();
await page.waitForFunction(() => window.__TEST__.opened.includes('https://example.com/docs'));
const download = panel.getByRole('button', { name: 'Download the engine' });
await download.focus();
assert.equal(await download.evaluate(element => element.matches(':focus-visible') || document.activeElement === element), true);
await shots('missing');
// Download, progress, and cancel.
await download.click();
await page.locator('.engine.tab[data-engine-state="downloading"]').waitFor();
await page.evaluate(() => window.__TEST__.setEngine({ received: 80306187 }));
await panel.getByText('80 MB of 161 MB', { exact: false }).waitFor();
assert.equal(await panel.locator('progress').evaluate(element => element.value), 80306187);
await shots('downloading');
await panel.getByRole('button', { name: 'Cancel' }).click();
await page.locator('.engine.tab[data-engine-state="missing"]').waitFor();
// A failed download shows its cause and Retry.
await page.evaluate(() => window.__TEST__.setEngine({ state: 'missing', error: 'The download stopped: the connection was reset.' }));
await panel.getByRole('alert').getByText('the connection was reset', { exact: false }).waitFor();
await panel.getByRole('button', { name: 'Retry' }).waitFor();
await shots('failed');
// After the installation, the same tab opens the page.
await panel.getByRole('button', { name: 'Retry' }).click();
await page.evaluate(() => window.__TEST__.setEngine({ state: 'installing' }));
await page.locator('.engine.tab[data-engine-state="installing"]').waitFor();
await page.evaluate(() => window.__TEST__.setEngine({ state: 'installed', error: null, received: 0 }));
await page.locator('[data-browser-state="ready"]').waitFor();
assert.equal(await panel.count(), 0);
assert.ok((await page.evaluate(() => window.__TEST__.requests)).includes('newTab'));
assert.equal(await page.evaluate(async () => (await import('/src/lib/plugins/registry.ts')).pluginHost.get('browser').open('https://example.com/link')), true);
// Settings → Browser: the installed engine, Remove with a confirmation, and the missing engine.
await page.goto(smokeUrl + '/?settingsWindow=true');
await page.evaluate(() => window.__TEST__.setEngine({ state: 'installed' }));
await page.getByRole('button', { name: 'Browser', exact: true }).click();
const section = page.locator('.engine.settings');
await section.getByText('Version 0.1.8 is installed.').waitFor();
await page.getByRole('button', { name: 'Search engine', exact: true }).waitFor();
await shots('settings-installed');
await section.getByRole('button', { name: 'Remove engine' }).click();
await page.locator('.engine.settings[data-engine-state="missing"]').waitFor();
assert.match((await page.evaluate(() => window.__TEST__.confirms))[0], /Your profiles, bookmarks, and history stay/);
assert.equal(await page.getByRole('button', { name: 'Search engine', exact: true }).count(), 0, 'Settings that need the engine are hidden.');
await page.getByText('The other browser settings show after the engine is installed.').waitFor();
await page.setViewportSize({ width: 360, height: 800 });
await shots('settings-missing-narrow');
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false);
console.log('Browser engine setup, progress, failure, install, links, and Settings checks passed.');
}, { viewport: { width: 1280, height: 800 } });
+2 -1
View File
@@ -114,7 +114,8 @@ await runSmoke("editor/interactions", async ({ page }) => {
await top();
}
await page.setViewportSize({ width: 640, height: 750 });
await page.getByRole("button", { name: "Hide outline", exact: true }).click();
// The outline gives way below 1100 pixels (UI-052). A click on "Hide outline" would race that change.
await page.getByRole("button", { name: "Show outline", exact: true }).waitFor();
await page.screenshot({ path: `${output}/editor-typography-narrow.png` });
assert.ok(await page.locator(".cm-content").evaluate(node => node.getBoundingClientRect().width <= node.closest(".cm-scroller").getBoundingClientRect().width + 1));
const spelling = await page.evaluate(async () => {
+2 -1
View File
@@ -42,7 +42,8 @@ await runSmoke("links/linkMenus", async ({ page }) => {
await page.locator('.cm-content').waitFor();
await page.evaluate(async () => {
const { pluginHost } = await import('/src/lib/plugins/registry.ts');
pluginHost.register('link-smoke', 'browser', { open: async target => { window.__TEST__.browser = target; return true; }, mountSettings: () => () => {}, mountBookmarks: () => () => {} });
// "Open link in app browser" opens a new browser tab with the link (newTab). A link click uses open.
pluginHost.register('link-smoke', 'browser', { newTab: async target => { window.__TEST__.browser = target; }, open: async target => { window.__TEST__.browser = target; return true; }, mountSettings: () => () => {}, mountBookmarks: () => () => {} });
});
for (const theme of ['dark', 'light']) {
await page.evaluate(async mode => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); saveAppearance({theme:'default', mode}); }, theme);