Fixes #627
parent
0ff005a595
commit
0296679827
|
@ -245,10 +245,11 @@ function render(
|
||||||
if (aliasNode) {
|
if (aliasNode) {
|
||||||
linkText = aliasNode.children![0].text!;
|
linkText = aliasNode.children![0].text!;
|
||||||
}
|
}
|
||||||
|
const [pageName] = ref.split(/[@$]/);
|
||||||
return {
|
return {
|
||||||
name: "a",
|
name: "a",
|
||||||
attrs: {
|
attrs: {
|
||||||
href: `/${ref.replace("@", "#")}`,
|
href: `/${pageName}`,
|
||||||
class: "wiki-link",
|
class: "wiki-link",
|
||||||
"data-ref": ref,
|
"data-ref": ref,
|
||||||
},
|
},
|
||||||
|
|
|
@ -183,7 +183,6 @@ export class HttpServer {
|
||||||
if (!this.clientAssetBundle.has(assetName)) {
|
if (!this.clientAssetBundle.has(assetName)) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
console.log("Asset name", assetName);
|
|
||||||
if (
|
if (
|
||||||
this.clientAssetBundle.has(assetName) &&
|
this.clientAssetBundle.has(assetName) &&
|
||||||
req.header("If-Modified-Since") ===
|
req.header("If-Modified-Since") ===
|
||||||
|
@ -205,7 +204,6 @@ export class HttpServer {
|
||||||
utcDateString(this.clientAssetBundle.getMtime(assetName)),
|
utcDateString(this.clientAssetBundle.getMtime(assetName)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// console.log("Serving it now", assetName);
|
|
||||||
|
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
if (assetName === "service_worker.js") {
|
if (assetName === "service_worker.js") {
|
||||||
|
|
|
@ -141,6 +141,10 @@ export class MarkdownWidget extends WidgetType {
|
||||||
const el = el_ as HTMLElement;
|
const el = el_ as HTMLElement;
|
||||||
// Override default click behavior with a local navigate (faster)
|
// Override default click behavior with a local navigate (faster)
|
||||||
el.addEventListener("click", (e) => {
|
el.addEventListener("click", (e) => {
|
||||||
|
if (e.ctrlKey || e.metaKey) {
|
||||||
|
// Don't do anything special for ctrl/meta clicks
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const [pageName, pos] = el.dataset.ref!.split(/[$@]/);
|
const [pageName, pos] = el.dataset.ref!.split(/[$@]/);
|
||||||
|
|
|
@ -31,6 +31,9 @@ export class LinkWidget extends WidgetType {
|
||||||
|
|
||||||
// Mouse handling
|
// Mouse handling
|
||||||
anchor.addEventListener("mousedown", (e) => {
|
anchor.addEventListener("mousedown", (e) => {
|
||||||
|
if (e.button !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.options.callback(e);
|
this.options.callback(e);
|
||||||
|
|
|
@ -298,11 +298,14 @@ export function createEditorState(
|
||||||
},
|
},
|
||||||
|
|
||||||
mousedown: (event: MouseEvent, view: EditorView) => {
|
mousedown: (event: MouseEvent, view: EditorView) => {
|
||||||
|
const pos = view.posAtCoords(event);
|
||||||
|
if (event.button !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!pos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
safeRun(async () => {
|
safeRun(async () => {
|
||||||
const pos = view.posAtCoords(event);
|
|
||||||
if (!pos) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const potentialClickEvent: ClickEvent = {
|
const potentialClickEvent: ClickEvent = {
|
||||||
page: pageName,
|
page: pageName,
|
||||||
ctrlKey: event.ctrlKey,
|
ctrlKey: event.ctrlKey,
|
||||||
|
|
Loading…
Reference in New Issue