Handle clicks on quotes
This commit is contained in:
parent
41c3c95aa3
commit
d77e98aa31
2 changed files with 19 additions and 6 deletions
|
@ -66,6 +66,7 @@ export interface Post {
|
|||
ipfs_cid: string | null;
|
||||
token_id: number | null;
|
||||
token_tx_id: string | null;
|
||||
quote: Post | null;
|
||||
}
|
||||
|
||||
export async function getHomeTimeline(
|
||||
|
|
|
@ -275,14 +275,26 @@ onMounted(() => {
|
|||
}
|
||||
const mentions = postContentRef.getElementsByClassName("mention")
|
||||
for (const mentionElement of Array.from(mentions)) {
|
||||
mentionElement.addEventListener("click", (event: Event) => {
|
||||
event.preventDefault()
|
||||
const mention = props.post.mentions
|
||||
.find((mention) => mention.url === mentionElement.getAttribute("href"))
|
||||
if (mention) {
|
||||
const mention = props.post.mentions
|
||||
.find((mention) => mention.url === mentionElement.getAttribute("href"))
|
||||
if (mention) {
|
||||
mentionElement.addEventListener("click", (event: Event) => {
|
||||
event.preventDefault()
|
||||
router.push({ name: "profile", params: { profileId: mention.id } })
|
||||
})
|
||||
}
|
||||
}
|
||||
const quote = props.post.quote
|
||||
if (quote) {
|
||||
const quotes = postContentRef.querySelectorAll(".quote-inline a")
|
||||
for (const quoteElement of Array.from(quotes)) {
|
||||
if (quote.uri === quoteElement.getAttribute("href")) {
|
||||
quoteElement.addEventListener("click", (event: Event) => {
|
||||
event.preventDefault()
|
||||
router.push({ name: "post", params: { postId: quote.id } })
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue