Add workspace links, restore tabs, and update project guides

This commit is contained in:
Knotty Wyvern
2026-10-21 21:05:48 -07:00
parent f741389418
commit 562ef87d24
46 changed files with 2999 additions and 1113 deletions
+13
View File
@@ -121,6 +121,19 @@ class Preview extends WidgetType {
previewFormulas.set(dom, this.formulas);
dom.className = "reading writer-preview";
dom.innerHTML = this.html;
// Widgets handle their own events, so CodeMirror's link handler cannot run.
dom.addEventListener("mousedown", event => {
if (event.button !== 0 || (!event.ctrlKey && !event.metaKey)) return;
const link = event.target instanceof Element ? event.target.closest<HTMLElement>("[data-href], a[href]") : null;
if (!link) return;
event.preventDefault();
event.stopPropagation();
void this.actions.linkActions?.().open?.({ kind: link.dataset.kind === "wiki" ? "wiki" : "md", target: link.dataset.href ?? link.getAttribute("href") ?? "" });
}, { capture: true });
// Cancel native anchor navigation even when an ordinary click reveals source.
dom.addEventListener("click", event => {
if (event.target instanceof Element && event.target.closest("a[href], [data-href]")) event.preventDefault();
}, { capture: true });
tableControls(dom, view, this.source, this.actions);
imageCleanups.set(dom, imageControls(dom, {}, () => { if (dom.isConnected) view.requestMeasure(); }));
this.measure(dom, view);