1
0
silverbullet/plugins/core/click.ts
2022-02-26 13:26:31 +01:00

14 lines
475 B
TypeScript

import { ClickEvent } from "../../webapp/src/app_event.ts";
import { syscall } from "./lib/syscall.ts";
export default async function click(event: ClickEvent) {
console.log("Event", event);
if (event.ctrlKey || event.metaKey) {
let syntaxNode = await syscall("editor.getSyntaxNodeAtPos", event.pos);
console.log("Here", syntaxNode);
if (syntaxNode && syntaxNode.name === "WikiLinkPage") {
await syscall("editor.navigate", syntaxNode.text);
}
}
}