fix: Heading hash on link dropped when pasting
This commit is contained in:
@@ -178,10 +178,12 @@ export default class PasteHandler extends Extension {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (document) {
|
if (document) {
|
||||||
|
const { hash } = new URL(text);
|
||||||
|
|
||||||
const title = `${
|
const title = `${
|
||||||
document.emoji ? document.emoji + " " : ""
|
document.emoji ? document.emoji + " " : ""
|
||||||
}${document.titleWithDefault}`;
|
}${document.titleWithDefault}`;
|
||||||
insertLink(document.path, title);
|
insertLink(`${document.path}${hash}`, title);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function parseDocumentSlug(url: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const split = parsed.split("#")[0].split("/");
|
const split = parsed.split("/");
|
||||||
const indexOfDoc = split.indexOf("doc");
|
const indexOfDoc = split.indexOf("doc");
|
||||||
return split[indexOfDoc + 1] ?? undefined;
|
return split[indexOfDoc + 1] ?? undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user