Add interface languages and improve themes and workspace controls for 0.1.36
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { t } from "$lib/i18n";
|
||||
import TerminalSlot from "$lib/plugins/TerminalSlot.svelte";
|
||||
import PluginTools from "$lib/plugins/PluginTools.svelte";
|
||||
import PluginAccessMenu from "$lib/plugins/PluginAccessMenu.svelte";
|
||||
@@ -75,7 +76,7 @@
|
||||
if (openingSettings) return;
|
||||
openingSettings = true;
|
||||
try { await invoke("settings_open_window"); }
|
||||
catch (reason) { error = `Could not open settings: ${String(reason)}`; }
|
||||
catch (reason) { error = $t("Could not open settings: {error}", { error: String(reason) }); }
|
||||
finally { openingSettings = false; }
|
||||
}
|
||||
let settings = $state<AppSettings>({ ...DEFAULT_SETTINGS });
|
||||
@@ -86,7 +87,7 @@
|
||||
let tabs = $state<OpenBuffer[]>([]);
|
||||
let activePath = $state<string | null>(null);
|
||||
const buffer = $derived(tabs.find((tab) => tab.relPath === activePath) ?? null);
|
||||
let status = $state("Open a workspace folder");
|
||||
let status = $state($t("Open a workspace folder"));
|
||||
let error = $state<string | null>(null);
|
||||
let refreshToken = $state(0);
|
||||
let view = $state<Chrome>("Writing");
|
||||
@@ -277,7 +278,7 @@
|
||||
|
||||
async function terminalAction(action: Exclude<ReturnType<Contributions["terminal"]["shortcut"]>, null | "toggle">) {
|
||||
if (!terminalEnabled) return;
|
||||
if (!workspace) { error = "Open a workspace to start a terminal."; return; }
|
||||
if (!workspace) { error = $t("Open a workspace to start a terminal."); return; }
|
||||
const started = terminalStarted;
|
||||
terminalStarted = true; terminalOpen = true;
|
||||
if (bottomHeight < 220) bottomHeight = 260;
|
||||
@@ -374,7 +375,7 @@
|
||||
focusLine = null;
|
||||
documents?.select(relPath);
|
||||
focusDocumentPane(documentPanes.active, true);
|
||||
status = documents?.active?.kind === "empty" ? "New tab" : relPath;
|
||||
status = documents?.active?.kind === "empty" ? $t("New tab") : relPath;
|
||||
}
|
||||
|
||||
function selectWorkingTab(path: string) {
|
||||
@@ -403,7 +404,7 @@
|
||||
const tab = workingTabs.find(tab => tab.id === item.id);
|
||||
const actions = tab && "plugin" in tab ? pluginTabActions(tab.plugin) : [];
|
||||
if (actions.some(action => "label" in action && /(?:move|open).*new window/i.test(action.label))) return actions;
|
||||
return tab ? [{ label: "Open in new window", icon: "external", disabled: !desktop || !workspace, run: () => { void detachTab(tab); } }, ...actions] : [];
|
||||
return tab ? [{ label: $t("Open in new window"), icon: "external", disabled: !desktop || !workspace, run: () => { void detachTab(tab); } }, ...actions] : [];
|
||||
}
|
||||
async function detachTab(item: WorkbenchTab, keepSource = false) {
|
||||
const tab = workingTabs.find(tab => tab.id === item.id);
|
||||
@@ -451,7 +452,7 @@
|
||||
focusLine = null;
|
||||
documents.newTab();
|
||||
terminalMaximized = false;
|
||||
status = "New tab";
|
||||
status = $t("New tab");
|
||||
error = null;
|
||||
}
|
||||
|
||||
@@ -471,7 +472,7 @@
|
||||
if ("buffer" in target) {
|
||||
if (!tab || (scope !== "one" && tab.pinned)) continue;
|
||||
const contents = tab.contents;
|
||||
if (contents !== tab.saved && !await confirm(`Discard unsaved edits in ${tab.name}?`, { title: "Close document", kind: "warning" })) break;
|
||||
if (contents !== tab.saved && !await confirm($t("Discard unsaved edits in {name}?", { name: tab.name }), { title: $t("Close document"), kind: "warning" })) break;
|
||||
if (documents !== current || switching || tab.contents !== contents) break;
|
||||
if (scope !== "one" && tab.pinned) continue;
|
||||
}
|
||||
@@ -491,7 +492,7 @@
|
||||
try {
|
||||
const text = system ? await workspaceAbsPath(path) : path;
|
||||
await navigator.clipboard.writeText(text);
|
||||
status = system ? "Copied system path" : "Copied workspace path";
|
||||
status = system ? $t("Copied system path") : $t("Copied workspace path");
|
||||
} catch (err) { error = String(err); }
|
||||
}
|
||||
|
||||
@@ -500,21 +501,21 @@
|
||||
const items: ActionMenuItem[] = [];
|
||||
if (tab.kind === "text" && isMarkdownPath(tab.relPath)) {
|
||||
items.push(
|
||||
{ label: "Save as template", icon: "copy", run: () => { void saveTemplate({ name: tab.name, rel_path: tab.relPath, kind: "file" }); } },
|
||||
{ label: reading ? "Editing view" : "Reading view", icon: "book", run: () => activeEditor()?.toggleReadingView() },
|
||||
{ label: isIde ? "Writing mode" : "Source mode", icon: "code", run: toggleChrome },
|
||||
{ label: $t("Save as template"), icon: "copy", run: () => { void saveTemplate({ name: tab.name, rel_path: tab.relPath, kind: "file" }); } },
|
||||
{ label: reading ? $t("Editing view") : $t("Reading view"), icon: "book", run: () => activeEditor()?.toggleReadingView() },
|
||||
{ label: isIde ? $t("Writing mode") : $t("Source mode"), icon: "code", run: toggleChrome },
|
||||
);
|
||||
}
|
||||
items.push({ separator: true },
|
||||
{ label: "Rename…", icon: "rename", run: () => { void renameActive(); } },
|
||||
{ label: $t("Rename…"), icon: "rename", run: () => { void renameActive(); } },
|
||||
);
|
||||
if (tab.kind === "text") items.push({ label: "Save a copy…", icon: "copy", run: () => { void saveCopy(); } });
|
||||
if (tab.kind === "text") items.push({ label: $t("Save a copy…"), icon: "copy", run: () => { void saveCopy(); } });
|
||||
items.push({ separator: true },
|
||||
{ label: "Copy path", icon: "copy", children: [
|
||||
{ label: "Workspace path", icon: "copy", run: () => { void copyTabPath(tab.relPath, false); } },
|
||||
{ label: "System path", icon: "copy", run: () => { void copyTabPath(tab.relPath, true); } },
|
||||
{ label: $t("Copy path"), icon: "copy", children: [
|
||||
{ label: $t("Workspace path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, false); } },
|
||||
{ label: $t("System path"), icon: "copy", run: () => { void copyTabPath(tab.relPath, true); } },
|
||||
] },
|
||||
{ label: "Show in system explorer", icon: "folder", run: () => { void workspaceReveal(tab.relPath).catch(err => { error = String(err); }); } },
|
||||
{ label: $t("Show in system explorer"), icon: "folder", run: () => { void workspaceReveal(tab.relPath).catch(err => { error = String(err); }); } },
|
||||
);
|
||||
return items;
|
||||
}
|
||||
@@ -595,7 +596,7 @@
|
||||
if (!workspace || !current || !note) return null;
|
||||
const folder = note.relPath.slice(0, note.relPath.lastIndexOf("/") + 1);
|
||||
const suggested = label.replace(/[<>:"/\\|?*\r\n]/g, " ").trim().slice(0, 60) || "Extracted selection";
|
||||
const name = await requestText("Extract selection to a new note (workspace relative path)", `${folder}${suggested}.md`);
|
||||
const name = await requestText($t("Extract selection to a new note (workspace relative path)"), `${folder}${suggested}.md`);
|
||||
if (!name || documents !== current || !valid() || saving || switching) return null;
|
||||
const rel = name.replaceAll("\\", "/").replace(/\.md$/i, "") + ".md";
|
||||
saving = true;
|
||||
@@ -603,7 +604,7 @@
|
||||
await workspaceCreate(rel, "file");
|
||||
await workspaceWrite(rel, markdown + "\n", "");
|
||||
refreshToken++;
|
||||
status = `Extracted selection to ${rel}`;
|
||||
status = $t("Extracted selection to {path}", { path: rel });
|
||||
return `/${rel}`;
|
||||
} catch (err) { error = String(err); return null; }
|
||||
finally { saving = false; }
|
||||
@@ -616,7 +617,7 @@
|
||||
saving = true;
|
||||
try {
|
||||
await current.save(tab.id);
|
||||
status = `Saved ${tab.relPath}`;
|
||||
status = $t("Saved {path}", { path: tab.relPath });
|
||||
error = null;
|
||||
} catch (err) {
|
||||
error = String(err);
|
||||
@@ -631,9 +632,9 @@
|
||||
try {
|
||||
const result = await current.autosave();
|
||||
if (documents !== current) return;
|
||||
if (result.saved.length) status = `Autosaved ${result.saved.length} ${result.saved.length === 1 ? "file" : "files"}`;
|
||||
if (result.saved.length) status = result.saved.length === 1 ? $t("Autosaved 1 file") : $t("Autosaved {count} files", { count: result.saved.length });
|
||||
if (result.failed.length) {
|
||||
error = result.failed.map(({ path, error }) => `Could not autosave ${path}: ${String(error)}`).join("\n");
|
||||
error = result.failed.map(({ path, error }) => $t("Could not autosave {path}: {error}", { path, error: String(error) })).join("\n");
|
||||
await current.refresh();
|
||||
}
|
||||
} finally { saving = false; }
|
||||
@@ -641,7 +642,7 @@
|
||||
|
||||
async function saveCopy(tab = buffer) {
|
||||
if (!tab || tab.kind !== "text") return;
|
||||
const name = await requestText("Save a copy as (workspace relative path)", tab.relPath.replace(/(\.[^./]+)?$/, " copy$1"));
|
||||
const name = await requestText($t("Save a copy as (workspace relative path)"), tab.relPath.replace(/(\.[^./]+)?$/, " copy$1"));
|
||||
if (!name) return;
|
||||
try {
|
||||
await workspaceCreate(name, "file");
|
||||
@@ -655,7 +656,7 @@
|
||||
if (!workspace) {
|
||||
return;
|
||||
}
|
||||
const name = await requestText("New file path relative to the workspace", "Untitled.md");
|
||||
const name = await requestText($t("New file path relative to the workspace"), "Untitled.md");
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
@@ -673,12 +674,12 @@
|
||||
}
|
||||
|
||||
async function saveTemplate(entry: TreeEntry) {
|
||||
const name = await requestText("Template name", entry.name.replace(/\.md$/i, ""));
|
||||
const name = await requestText($t("Template name"), entry.name.replace(/\.md$/i, ""));
|
||||
if (!name) return;
|
||||
try {
|
||||
const contents = documents?.buffers.find(tab => tab.relPath === entry.rel_path)?.contents ?? await workspaceRead(entry.rel_path);
|
||||
await saveNoteTemplate(name, contents);
|
||||
status = `Saved template: ${name}`;
|
||||
status = $t("Saved template: {name}", { name });
|
||||
} catch (reason) { error = String(reason); }
|
||||
}
|
||||
|
||||
@@ -697,9 +698,9 @@
|
||||
const close = () => { menu.remove(); window.removeEventListener("pointerdown", outside); anchor?.focus(); };
|
||||
const outside = (event: PointerEvent) => { if (!menu.contains(event.target as Node)) close(); };
|
||||
const menu = actionMenu(event.clientX, event.clientY, [
|
||||
{ label: "Blank note", icon: "file-plus", run: () => { close(); void create(); } },
|
||||
{ label: $t("Blank note"), icon: "file-plus", run: () => { close(); void create(); } },
|
||||
...templates.map(template => ({ label: template.name, icon: "file-plus" as const, run: () => { close(); void create(template); } })),
|
||||
], close, "New note");
|
||||
], close, $t("New note"));
|
||||
window.addEventListener("pointerdown", outside);
|
||||
}
|
||||
|
||||
@@ -806,7 +807,7 @@
|
||||
current.rename(from, plan.to);
|
||||
if (documents !== current) return;
|
||||
refreshToken += 1;
|
||||
status = `Renamed to ${plan.to}`;
|
||||
status = $t("Renamed to {path}", { path: plan.to });
|
||||
error = null;
|
||||
}
|
||||
|
||||
@@ -816,7 +817,7 @@
|
||||
}
|
||||
const current = documents;
|
||||
const from = activePath;
|
||||
const typed = await requestText("Rename to", from.split("/").pop() ?? from);
|
||||
const typed = await requestText($t("Rename to"), from.split("/").pop() ?? from);
|
||||
if (typed == null || documents !== current || switching) {
|
||||
return;
|
||||
}
|
||||
@@ -833,7 +834,7 @@
|
||||
current?.rename(from, plan.to);
|
||||
if (documents !== current) return;
|
||||
refreshToken += 1;
|
||||
status = `Renamed to ${plan.to}`;
|
||||
status = $t("Renamed to {path}", { path: plan.to });
|
||||
error = null;
|
||||
} catch (err) {
|
||||
error = err instanceof Error ? err.message : String(err);
|
||||
@@ -852,13 +853,13 @@
|
||||
const found = files.find(file => file.rel_path === path && file.kind === "file");
|
||||
if (found) return found;
|
||||
}
|
||||
throw new Error(`Could not find ${link.target} in the workspace.`);
|
||||
throw new Error($t("Could not find {path} in the workspace.", { path: link.target }));
|
||||
};
|
||||
const run = (action: (file: TreeEntry) => void | Promise<void>) => () => {
|
||||
void entry().then(file => { if (valid()) return action(file); }).catch(reason => { error = String(reason); });
|
||||
};
|
||||
async function rename(file: TreeEntry, move = false) {
|
||||
const typed = await requestText(move ? "Move file to (workspace path, including filename)" : "New file name", move ? file.rel_path : file.name);
|
||||
const typed = await requestText(move ? $t("Move file to (workspace path, including filename)") : $t("New file name"), move ? file.rel_path : file.name);
|
||||
if (!typed || !valid()) return;
|
||||
let to = typed.trim().replaceAll("\\", "/");
|
||||
if (move) {
|
||||
@@ -877,31 +878,31 @@
|
||||
applyPathRename(file.rel_path, to);
|
||||
await saveMarks(moveMarks(marks, file.rel_path, to));
|
||||
refreshToken++;
|
||||
status = `Moved to ${to}`;
|
||||
status = $t("Moved to {path}", { path: to });
|
||||
}
|
||||
return [
|
||||
{ label: "Open to the right", icon: "split-right", run: run(file => openToRight(file, sourcePane)) },
|
||||
{ label: "Open in new window", icon: "external", disabled: !desktop, run: run(async file => {
|
||||
{ label: $t("Open to the right"), icon: "split-right", run: run(file => openToRight(file, sourcePane)) },
|
||||
{ label: $t("Open in new window"), icon: "external", disabled: !desktop, run: run(async file => {
|
||||
await openFile(file, undefined, "new");
|
||||
if (!valid()) return;
|
||||
const tab = workingTabs.find(tab => tab.relPath === file.rel_path);
|
||||
if (tab) await detachTab(tab, true);
|
||||
}) },
|
||||
{ label: "Copy path", icon: "copy", children: [
|
||||
{ label: "Workspace path", icon: "copy", run: run(file => copyTabPath(file.rel_path, false)) },
|
||||
{ label: "System path", icon: "copy", run: run(file => copyTabPath(file.rel_path, true)) },
|
||||
{ label: $t("Copy path"), icon: "copy", children: [
|
||||
{ label: $t("Workspace path"), icon: "copy", run: run(file => copyTabPath(file.rel_path, false)) },
|
||||
{ label: $t("System path"), icon: "copy", run: run(file => copyTabPath(file.rel_path, true)) },
|
||||
] },
|
||||
{ label: "Rename…", icon: "rename", run: run(file => rename(file)) },
|
||||
{ label: "Move file to…", icon: "folder", run: run(file => rename(file, true)) },
|
||||
{ label: "Bookmark", icon: "bookmark", run: run(async file => {
|
||||
{ label: $t("Rename…"), icon: "rename", run: run(file => rename(file)) },
|
||||
{ label: $t("Move file to…"), icon: "folder", run: run(file => rename(file, true)) },
|
||||
{ label: $t("Bookmark"), icon: "bookmark", run: run(async file => {
|
||||
const marks = await loadMarks();
|
||||
if (!valid()) return;
|
||||
if (!marks.bookmarks.includes(file.rel_path)) await saveMarks({ ...marks, bookmarks: [...marks.bookmarks, file.rel_path] });
|
||||
refreshToken++; status = `Bookmarked ${file.name}`;
|
||||
refreshToken++; status = $t("Bookmarked {name}", { name: file.name });
|
||||
}) },
|
||||
{ label: "Open in default app", icon: "external", run: run(file => workspaceOpenDefault(file.rel_path)) },
|
||||
{ label: "Show in system explorer", icon: "folder", run: run(file => workspaceReveal(file.rel_path)) },
|
||||
{ label: "Reveal file in navigation", icon: "folder", run: run(async file => { closePluginSidebar(); leftView = "files"; leftOpen = true; await tick(); await fileTree?.revealPath(file.rel_path); }) },
|
||||
{ label: $t("Open in default app"), icon: "external", run: run(file => workspaceOpenDefault(file.rel_path)) },
|
||||
{ label: $t("Show in system explorer"), icon: "folder", run: run(file => workspaceReveal(file.rel_path)) },
|
||||
{ label: $t("Reveal file in navigation"), icon: "folder", run: run(async file => { closePluginSidebar(); leftView = "files"; leftOpen = true; await tick(); await fileTree?.revealPath(file.rel_path); }) },
|
||||
];
|
||||
}
|
||||
|
||||
@@ -922,7 +923,7 @@
|
||||
return;
|
||||
} catch { /* Try the workspace-root candidate after the note-relative path. */ }
|
||||
}
|
||||
error = `Could not open ${target}`;
|
||||
error = $t("Could not open {path}", { path: target });
|
||||
}
|
||||
|
||||
function onPointerMove(event: PointerEvent) {
|
||||
@@ -1028,7 +1029,7 @@
|
||||
closing = true;
|
||||
try {
|
||||
const message = [hasDirty ? "Unsaved edits will be discarded." : "", terminalStarted ? "Terminal sessions will end." : ""].filter(Boolean).join("\n");
|
||||
if (await confirm(`${message}\nClose RuneStone?`, { title: "Close workspace", kind: "warning" })) await getCurrentWindow().destroy();
|
||||
if (await confirm(`${message}\n${$t("Close RuneStone?")}`, { title: $t("Close workspace"), kind: "warning" })) await getCurrentWindow().destroy();
|
||||
} finally { closing = false; }
|
||||
}).then(register).catch(err => error = String(err));
|
||||
const focus = () => { void documents?.refresh(); refreshToken++; };
|
||||
@@ -1061,7 +1062,7 @@
|
||||
class:left-open={!transferredWindow && leftOpen}
|
||||
class:right-open={!transferredWindow && rightOpen}
|
||||
role="application"
|
||||
aria-label="RuneStone workbench"
|
||||
aria-label={$t("RuneStone workbench")}
|
||||
style:--left="{leftWidth}px"
|
||||
style:--right="{rightWidth}px"
|
||||
style:--bottom="{bottomHeight}px"
|
||||
@@ -1075,19 +1076,19 @@
|
||||
{#if !transferredWindow}
|
||||
<IconButton
|
||||
icon="files"
|
||||
label="Files"
|
||||
label={$t("Files")}
|
||||
active={leftOpen && !$pluginSidebar && leftView === "files"}
|
||||
onclick={() => selectLeft("files")}
|
||||
/>
|
||||
<IconButton
|
||||
icon="search"
|
||||
label="Search"
|
||||
label={$t("Search")}
|
||||
active={leftOpen && !$pluginSidebar && leftView === "search"}
|
||||
onclick={() => selectLeft("search")}
|
||||
/>
|
||||
<IconButton
|
||||
icon="bookmark"
|
||||
label="Bookmarks"
|
||||
label={$t("Bookmarks")}
|
||||
active={leftOpen && !$pluginSidebar && leftView === "bookmarks"}
|
||||
onclick={() => selectLeft("bookmarks")}
|
||||
/>
|
||||
@@ -1107,19 +1108,19 @@
|
||||
fileActions={workingTabFileActions} tabActions={workingTabActions} onMove={moveWorkingTab}
|
||||
onDetach={(tab) => { void detachTab(tab); }}
|
||||
tabDragData={workingTabDragData} onDropTab={(data, index) => void receiveTab(data, index)} />
|
||||
<IconButton icon="plus" label="New tab (Ctrl T)" onclick={newTab} />
|
||||
<IconButton icon="plus" label={$t("New tab (Ctrl T)")} onclick={newTab} />
|
||||
{#if desktop}<div class="window-drag-space" data-tauri-drag-region></div>{/if}
|
||||
</div>
|
||||
<div class="header-right" data-tauri-drag-region>
|
||||
{#if browserContribution?.newTab}<IconButton icon="globe" label="New browser tab" disabled={browserOpening} onclick={() => void openBrowser()} />{/if}
|
||||
{#if browserContribution?.newTab}<IconButton icon="globe" label={$t("New browser tab")} disabled={browserOpening} onclick={() => void openBrowser()} />{/if}
|
||||
<PluginAccessMenu surface="open" compact />
|
||||
<PluginTools />
|
||||
<PluginAccessMenu surface="commands" compact />
|
||||
<IconButton icon="save" label="Save" disabled={editorPluginVisible || !dirty || saving} onclick={() => void save()} />
|
||||
{#if terminalEnabled}<IconButton icon="terminal" label="Terminal" active={terminalOpen} onclick={toggleTerminal} />{/if}
|
||||
<IconButton icon="save" label={$t("Save")} disabled={editorPluginVisible || !dirty || saving} onclick={() => void save()} />
|
||||
{#if terminalEnabled}<IconButton icon="terminal" label={$t("Terminal")} active={terminalOpen} onclick={toggleTerminal} />{/if}
|
||||
{#if !transferredWindow}<IconButton
|
||||
icon="panel-right"
|
||||
label={rightOpen ? "Hide outline" : "Show outline"}
|
||||
label={rightOpen ? $t("Hide outline") : $t("Show outline")}
|
||||
active={rightOpen}
|
||||
onclick={() => (rightOpen = !rightOpen)}
|
||||
/>{/if}
|
||||
@@ -1127,7 +1128,7 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{#if !transferredWindow}<nav class="plugin-ribbon" aria-label="Plugin shortcuts" hidden={ribbonNavigation.length === 0}>
|
||||
{#if !transferredWindow}<nav class="plugin-ribbon" aria-label={$t("Plugin shortcuts")} hidden={ribbonNavigation.length === 0}>
|
||||
{#each ribbonNavigation as item (`${item.owner}:${item.id}`)}
|
||||
<IconButton
|
||||
icon={item.icon === "list" || item.icon === "kanban" || item.icon === "globe" || item.icon === "git" ? item.icon : "puzzle"}
|
||||
@@ -1147,7 +1148,7 @@
|
||||
{/if}
|
||||
<div class="native-left" class:sidebar-covered={!!$pluginSidebar}>
|
||||
{#if !workspace}
|
||||
{#if leftView === "bookmarks"}<BrowserSlot kind="bookmarks" />{:else}<p class="placeholder">No folder is open.</p>{/if}
|
||||
{#if leftView === "bookmarks"}<BrowserSlot kind="bookmarks" />{:else}<p class="placeholder">{$t("No folder is open.")}</p>{/if}
|
||||
{:else}
|
||||
<div class="left-stack">
|
||||
<div class="left-layer" class:shown={leftView === "files"}>
|
||||
@@ -1183,12 +1184,12 @@
|
||||
</div>
|
||||
<div class="left-footer">
|
||||
<div class="footer-start" bind:this={workspaceAnchor}>
|
||||
<IconButton icon="folder-open" label="Open folder" onclick={chooseWorkspace} />
|
||||
<span class="ws">{workspace ? workspace.name : "No workspace"}</span>
|
||||
<IconButton icon="folder-open" label={$t("Open folder")} onclick={chooseWorkspace} />
|
||||
<span class="ws">{workspace ? workspace.name : $t("No workspace")}</span>
|
||||
</div>
|
||||
<div class="footer-actions">
|
||||
<IconButton icon="help" label="Help and about (F1)" onclick={() => preferences = "help"} />
|
||||
<IconButton icon="settings" label="Settings (Ctrl+,)" onclick={() => void openSettings()} />
|
||||
<IconButton icon="help" label={$t("Help and about (F1)")} onclick={() => preferences = "help"} />
|
||||
<IconButton icon="settings" label={$t("Settings (Ctrl+,)")} onclick={() => void openSettings()} />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -1231,15 +1232,15 @@
|
||||
onpointerdowncapture={() => focusDocumentPane(pane.id)}
|
||||
onfocusin={() => focusDocumentPane(pane.id)}>
|
||||
{#if pane.buffer?.diskError}
|
||||
<div class="conflict" role="alert"><span>{pane.buffer.diskError}</span><button onclick={() => void saveCopy(pane.buffer)}>Save a copy</button><button onclick={() => void documents?.refresh()}>Retry</button></div>
|
||||
<div class="conflict" role="alert"><span>{pane.buffer.diskError}</span><button onclick={() => void saveCopy(pane.buffer)}>{$t("Save a copy")}</button><button onclick={() => void documents?.refresh()}>{$t("Retry")}</button></div>
|
||||
{:else if pane.buffer?.diskContents != null}
|
||||
<div class="conflict" role="alert">
|
||||
<span>This file changed on disk. Your edits are preserved. Review both versions before saving.</span>
|
||||
<button onclick={() => { if (pane.buffer) documents?.resolve(pane.buffer.id, true); }}>Use disk version</button>
|
||||
<button onclick={() => { if (pane.buffer) documents?.resolve(pane.buffer.id, false); }}>Keep my edits</button>
|
||||
<button onclick={() => void saveCopy(pane.buffer)}>Save a copy</button>
|
||||
<span>{$t("This file changed on disk. Your edits are preserved. Review both versions before saving.")}</span>
|
||||
<button onclick={() => { if (pane.buffer) documents?.resolve(pane.buffer.id, true); }}>{$t("Use disk version")}</button>
|
||||
<button onclick={() => { if (pane.buffer) documents?.resolve(pane.buffer.id, false); }}>{$t("Keep my edits")}</button>
|
||||
<button onclick={() => void saveCopy(pane.buffer)}>{$t("Save a copy")}</button>
|
||||
</div>
|
||||
<details class="disk-review"><summary>View disk version</summary><pre>{pane.buffer.diskContents}</pre></details>
|
||||
<details class="disk-review"><summary>{$t("View disk version")}</summary><pre>{pane.buffer.diskContents}</pre></details>
|
||||
{/if}
|
||||
<EditorPane
|
||||
bind:this={paneComponents[pane.id]}
|
||||
@@ -1290,7 +1291,7 @@
|
||||
getSelection={() => selectedEditorText(buffer?.id)} onConfigureTasks={configureTasks} />
|
||||
{/key}
|
||||
{:else}
|
||||
<p class="placeholder">Open a workspace to start the terminal.</p>
|
||||
<p class="placeholder">{$t("Open a workspace to start the terminal.")}</p>
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
@@ -1322,7 +1323,7 @@
|
||||
{#if workspace}
|
||||
<span>{workspace.watch_mode} watch</span>
|
||||
{/if}
|
||||
<span>{isIde ? "IDE" : "Writer"}</span>
|
||||
<span>{isIde ? $t("IDE") : $t("Writer")}</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user