fix: Do not copy edit path from headers

chore: Rename url -> path in routeHelpers
closes #5229
This commit is contained in:
Tom Moor
2023-04-22 10:00:09 -04:00
parent 4b5680a16e
commit e2c5fda610
19 changed files with 91 additions and 80 deletions

View File

@@ -58,9 +58,7 @@ export default class Heading extends Node {
anchor.innerText = "#";
anchor.type = "button";
anchor.className = "heading-anchor";
anchor.addEventListener("click", (event) =>
this.handleCopyLink(event)
);
anchor.addEventListener("click", this.handleCopyLink);
fold = document.createElement("button");
fold.innerText = "";
@@ -181,8 +179,10 @@ export default class Heading extends Node {
// the existing url might contain a hash already, lets make sure to remove
// that rather than appending another one.
const urlWithoutHash = window.location.href.split("#")[0];
copy(urlWithoutHash + hash);
const normalizedUrl = window.location.href
.split("#")[0]
.replace("/edit", "");
copy(normalizedUrl + hash);
this.options.onShowToast(this.options.dictionary.linkCopied);
};