Skip to content

Commit

Permalink
0.8.17
Browse files Browse the repository at this point in the history
Fix for #53 #76
  • Loading branch information
alangrainger committed Sep 30, 2024
1 parent 545c6f2 commit 6622005
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 43 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "share-note",
"name": "Share Note",
"version": "0.8.16",
"version": "0.8.17",
"minAppVersion": "0.15.0",
"description": "Instantly share a note, with the full theme and content exactly like you see in Reading View. Data is shared encrypted by default, and only you and the person you send it to have the key.",
"author": "Alan Grainger",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "share-note",
"version": "0.8.16",
"version": "0.8.17",
"description": "Instantly share a note, with the full theme and content exactly like you see in Reading View. Data is shared encrypted by default, and only you and the person you send it to have the key.",
"main": "main.js",
"scripts": {
Expand Down
18 changes: 12 additions & 6 deletions src/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,21 @@ export default class Note {
}

// Replace links
for (const el of this.contentDom.querySelectorAll<HTMLElement>('a.internal-link')) {
for (const el of this.contentDom.querySelectorAll<HTMLElement>('a.internal-link, a.footnote-link')) {
const href = el.getAttribute('href')
const match = href ? href.match(/^([^#]+)/) : null
if (href?.match(/^#/)) {
// Anchor link to a document heading, we need to add custom Javascript to jump to that heading
const selector = `[data-heading="${href.slice(1)}"]`
if (this.contentDom.querySelectorAll(selector)?.[0]) {
el.setAttribute('onclick', `document.querySelectorAll('${selector}')[0].scrollIntoView(true)`)
}
// This is an Anchor link to a document heading, we need to add custom Javascript
// to jump to that heading rather than using the normal # link
const linkTypes = [
`[data-heading="${href.slice(1)}"]`, // Links to a heading
`[id="${href.slice(1)}"]`, // Links to a footnote
]
linkTypes.forEach(selector => {
if (this.contentDom.querySelectorAll(selector)?.[0]) {
el.setAttribute('onclick', `document.querySelectorAll('${selector}')[0].scrollIntoView(true)`)
}
})
el.removeAttribute('target')
el.removeAttribute('href')
continue
Expand Down
35 changes: 2 additions & 33 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
{
"0.5.0": "0.15.0",
"0.5.1": "0.15.0",
"0.5.2": "0.15.0",
"0.5.3": "0.15.0",
"0.5.4": "0.15.0",
"0.5.5": "0.15.0",
"0.5.6": "0.15.0",
"0.5.7": "0.15.0",
"0.5.8": "0.15.0",
"0.5.9": "0.15.0",
"0.5.10": "0.15.0",
"0.5.11": "0.15.0",
"0.5.12": "0.15.0",
"0.5.13": "0.15.0",
"0.5.14": "0.15.0",
"0.5.15": "0.15.0",
"0.5.16": "0.15.0",
"0.5.17": "0.15.0",
"0.5.18": "0.15.0",
"0.5.19": "0.15.0",
"0.5.20": "0.15.0",
"0.5.21": "0.15.0",
"0.5.22": "0.15.0",
"0.5.23": "0.15.0",
"0.5.24": "0.15.0",
"0.6.0": "0.15.0",
"0.6.1": "0.15.0",
"0.6.2": "0.15.0",
"0.6.3": "0.15.0",
"0.6.4": "0.15.0",
"0.7.0": "0.15.0",
"0.7.1": "0.15.0",
"0.8.0": "0.15.0",
"0.8.1": "0.15.0",
"0.8.2": "0.15.0",
Expand All @@ -47,5 +15,6 @@
"0.8.13": "0.15.0",
"0.8.14": "0.15.0",
"0.8.15": "0.15.0",
"0.8.16": "0.15.0"
"0.8.16": "0.15.0",
"0.8.17": "0.15.0"
}

0 comments on commit 6622005

Please sign in to comment.