Update editor, themes, menus, backgrounds, and release tooling

This commit is contained in:
Knotty Wyvern
2026-10-14 16:19:51 -07:00
parent f6eaa52949
commit edef2520af
113 changed files with 5722 additions and 386 deletions
+34 -6
View File
@@ -469,11 +469,16 @@
}
async function createIn(parent: string, kind: "folder" | "note" | "file") {
const operationRoot = workspaceRoot;
let name: string;
if (kind === "note") {
name = "untitled.md";
if (kind === "note" || kind === "folder") {
name = kind === "folder" ? "untitled" : "untitled.md";
if (kind === "folder") {
await load(parent);
if (workspaceRoot !== operationRoot || error) return;
}
} else {
const typed = await requestText(kind === "folder" ? "Folder name" : "File name, including any extension", kind === "folder" ? "folder" : "Untitled");
const typed = await requestText("File name, including any extension", "Untitled");
if (!typed) {
return;
}
@@ -484,21 +489,26 @@
}
name = typed.trim();
}
const finalName = kind === "file" ? name : uniqueName(namesIn(parent), name);
if (workspaceRoot !== operationRoot) return;
const finalName = kind === "file" ? name : uniqueName(kind === "folder" ? namesIn(parent).map(value => value.toLowerCase()) : namesIn(parent), name);
const rel = joinRel(parent, finalName);
try {
await workspaceCreate(rel, kind === "folder" ? "folder" : "file");
if (workspaceRoot !== operationRoot) return;
const order = { ...marks.order };
order[parent] = [...(order[parent] ?? []), finalName];
await persistMarks({ ...marks, order });
if (!childrenMap[parent] && parent !== "") {
if (kind === "folder" || (!childrenMap[parent] && parent !== "")) {
const next = new Set(expanded);
next.add(parent);
expanded = next;
}
await load(parent);
if (workspaceRoot !== operationRoot) return;
onStatus?.(`Created ${rel}`);
if (kind !== "folder") {
if (kind === "folder") {
startRename({ name: finalName, rel_path: rel, kind: "folder" });
} else {
onCreated?.({ name: finalName, rel_path: rel, kind: "file" });
}
} catch (err) {
@@ -575,6 +585,24 @@
await focusTreePath(paths.values().next().value);
}
export async function revealPath(path: string) {
const operationRoot = workspaceRoot;
const folders = path.split("/").slice(0, -1);
await load("");
let parent = "";
for (const folder of folders) {
if (workspaceRoot !== operationRoot) return;
parent = parent ? `${parent}/${folder}` : folder;
expanded = new Set([...expanded, parent]);
await load(parent);
}
if (workspaceRoot !== operationRoot) return;
selectOnly(path);
await focusTreePath(path);
const target = [...treeElement.querySelectorAll<HTMLElement>("[data-tree-rel]")].find(node => node.dataset.treeRel === path);
target?.scrollIntoView({ block: "nearest" });
}
async function focusTreePath(path?: string) {
await tick();
const target = [...treeElement.querySelectorAll<HTMLElement>("[data-tree-rel]")].find(node => node.dataset.treeRel === path);