Add workspace links, restore tabs, and update project guides
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user