pull/917/head
Zef Hemel 2024-07-02 20:13:41 +02:00
parent cf9b8f07ab
commit 1e58d220eb
3 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,6 @@ async function actionClickOrActionEnter(
if (!mdTree) { if (!mdTree) {
return; return;
} }
// console.log("Got a click on", mdTree);
const navigationNodeFinder = (t: ParseTree) => const navigationNodeFinder = (t: ParseTree) =>
[ [
"WikiLink", "WikiLink",
@ -61,7 +60,7 @@ async function actionClickOrActionEnter(
if (pageRef.pos === undefined) { if (pageRef.pos === undefined) {
pageRef.pos = 0; pageRef.pos = 0;
} }
return editor.navigate(pageRef, false); return editor.navigate(pageRef, false, inNewWindow);
} }
} }
case "PageRef": { case "PageRef": {
@ -89,6 +88,8 @@ async function actionClickOrActionEnter(
} else { } else {
return editor.navigate( return editor.navigate(
parsePageRef(resolvePath(currentPage, decodeURI(url))), parsePageRef(resolvePath(currentPage, decodeURI(url))),
false,
inNewWindow,
); );
} }
} else { } else {

View File

@ -174,7 +174,7 @@ export class MarkdownWidget extends WidgetType {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const pageRef = parsePageRef(el.dataset.ref!); const pageRef = parsePageRef(el.dataset.ref!);
this.client.navigate(pageRef); this.client.navigate(pageRef, false, e.ctrlKey || e.metaKey);
}); });
}); });

View File

@ -5,7 +5,6 @@ import { Client } from "../client.ts";
import { decoratorStateField, isCursorInRange, LinkWidget } from "./util.ts"; import { decoratorStateField, isCursorInRange, LinkWidget } from "./util.ts";
import { resolvePath } from "$sb/lib/resolve.ts"; import { resolvePath } from "$sb/lib/resolve.ts";
import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts"; import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts";
import { wikiLinkRegex } from "$common/markdown_parser/parser.ts";
/** /**
* Plugin to hide path prefix when the cursor is not inside. * Plugin to hide path prefix when the cursor is not inside.