mirror of
https://github.com/outline/outline.git
synced 2026-01-07 03:30:10 -06:00
* fix: remove overflow x in toc * fix: use useMemo * fix: parsing /settings/integrations/slack * fix: no transparency in firefox * fix: remove debounced fn
18 lines
312 B
TypeScript
18 lines
312 B
TypeScript
export default function parseDocumentSlug(url: string) {
|
|
let parsed;
|
|
|
|
if (url[0] === "/") {
|
|
parsed = url;
|
|
} else {
|
|
try {
|
|
parsed = new URL(url).pathname;
|
|
} catch (err) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
return parsed.lastIndexOf("/doc/") === 0
|
|
? parsed.replace(/^\/doc\//, "")
|
|
: null;
|
|
}
|