Add object link handlers to all matching <a> elements
This commit is contained in:
parent
d74cb71438
commit
48f9c1800a
1 changed files with 4 additions and 4 deletions
|
@ -301,10 +301,10 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
const quote = props.post.quote
|
const quote = props.post.quote
|
||||||
if (quote) {
|
if (quote) {
|
||||||
const quotes = postContentRef.querySelectorAll(".quote-inline a")
|
const links = postContentRef.querySelectorAll("a")
|
||||||
for (const quoteElement of Array.from(quotes)) {
|
for (const linkElement of Array.from(links)) {
|
||||||
if (quote.uri === quoteElement.getAttribute("href")) {
|
if (quote.uri === linkElement.getAttribute("href")) {
|
||||||
quoteElement.addEventListener("click", (event: Event) => {
|
linkElement.addEventListener("click", (event: Event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
router.push({ name: "post", params: { postId: quote.id } })
|
router.push({ name: "post", params: { postId: quote.id } })
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue