We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67c2bd2 commit eef8ba5Copy full SHA for eef8ba5
src/lib/platform.ts
@@ -3,11 +3,27 @@ import { openExternal } from './electronOnly'
3
4
export const appIsElectron = isElectron()
5
6
+const isInternalLink = (link: string) => link[0] === '#'
7
+
8
+const openInternalLink = (link: string) => {
9
+ const extractedId = link.slice(1)
10
+ const targetId = `user-content-${extractedId}`
11
+ const targetElement = window.document.getElementById(targetId)
12
+ if (targetElement != null) {
13
+ targetElement.scrollIntoView()
14
+ }
15
+}
16
17
export const openNew = (url: string) => {
18
if (url.length === 0) {
19
return
20
}
21
22
+ if (isInternalLink(url)) {
23
+ openInternalLink(url)
24
+ return
25
26
27
if (appIsElectron) {
28
openExternal(url)
29
} else {
0 commit comments