mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
core: parse internal link from href
This commit is contained in:
committed by
Abdullah Atta
parent
4fc5ec00ae
commit
ef6c4bb6fb
@@ -53,8 +53,9 @@ export function createInternalLink<T extends InternalLinkType>(
|
||||
|
||||
export function parseInternalLink(link: string): InternalLink | undefined {
|
||||
const url = new URL(link);
|
||||
|
||||
if (url.protocol !== "nn:") return;
|
||||
const [type, id] = url.pathname.split("/").slice(2);
|
||||
const [type, id] = url.href.split("?")[0].split("/").slice(2);
|
||||
if (!type || !id || !isValidInternalType(type)) return;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user