Add interface languages and improve themes and workspace controls for 0.1.36

This commit is contained in:
Knotty Wyvern
2026-10-15 10:55:59 -07:00
parent b066359b66
commit 68e86ab6eb
98 changed files with 5499 additions and 874 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
import { tr } from '../i18n/index.ts';
import { EditorView, WidgetType } from "@codemirror/view";
import { isolateHistory } from "@codemirror/commands";
import { imageControls, type ImageActions } from "./imageControls";
@@ -48,9 +49,9 @@ export class ImagePreview extends WidgetType {
report: this.context.report,
swap: async image => {
const before = view.state.doc;
const path = (await requestText("Image path relative to this note, or https URL", image.dataset.mdSrc || ""))?.trim();
const path = (await requestText(tr("Image path relative to this note, or https URL"), image.dataset.mdSrc || ""))?.trim();
if (!path || !dom.isConnected || view.state.doc !== before) return;
if (!isRemoteImage(path) && /^[a-z][a-z\d+.-]*:/i.test(path)) throw new Error("Choose a workspace image path or an http/https URL.");
if (!isRemoteImage(path) && /^[a-z][a-z\d+.-]*:/i.test(path)) throw new Error(tr("Choose a workspace image path or an http/https URL."));
await this.context.validate?.(path);
if (!dom.isConnected || view.state.doc !== before) return;
const target = path.replace(/[<>\s]/g, char => encodeURIComponent(char));
@@ -63,7 +64,7 @@ export class ImagePreview extends WidgetType {
if (!dom.querySelector("img")) {
const edit = document.createElement("button");
edit.type = "button"; edit.className = "image-action";
const label = this.editing ? "Hide image source" : "Edit image source";
const label = this.editing ? tr("Hide image source") : tr("Edit image source");
edit.setAttribute("aria-label", label); edit.dataset.editorTooltip = label;
edit.append(actionIcon("code"));
edit.addEventListener("click", event => { event.preventDefault(); event.stopPropagation(); (this.editing ? actions.done : actions.edit)?.(); });