Fix for #53 #76
This commit is contained in:
Alan Grainger 2024-09-30 15:23:00 +02:00
parent 545c6f2163
commit 6622005aa3
5 changed files with 18 additions and 43 deletions

View file

@ -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",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "share-note",
"version": "0.8.16",
"version": "0.8.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "share-note",
"version": "0.8.16",
"version": "0.8.17",
"license": "MIT",
"dependencies": {
"csso": "^5.0.5",

View file

@ -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": {

View file

@ -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

View file

@ -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",
@ -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"
}