Browse Source

deal with highlights without source tags

imwald
Silberengel 5 months ago
parent
commit
bc762f451a
  1. 12
      src/components/Note/Highlight/index.tsx

12
src/components/Note/Highlight/index.tsx

@ -41,7 +41,17 @@ export default function Highlight({
}) })
} }
} else { } else {
const rTag = event.tags.find(tag => tag[0] === 'r' && tag[2] === 'source') // First try to find r-tag with 'source' marker
let rTag = event.tags.find(tag => tag[0] === 'r' && tag[2] === 'source')
// If no r-tag with 'source' marker found, check if there's only one r-tag
if (!rTag) {
const rTags = event.tags.filter(tag => tag[0] === 'r')
if (rTags.length === 1) {
rTag = rTags[0]
}
}
if (rTag) { if (rTag) {
source = { source = {
type: 'url' as const, type: 'url' as const,

Loading…
Cancel
Save