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;
|
ipfs_cid: string | null;
|
||||||
token_id: number | null;
|
token_id: number | null;
|
||||||
token_tx_id: string | null;
|
token_tx_id: string | null;
|
||||||
|
quote: Post | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getHomeTimeline(
|
export async function getHomeTimeline(
|
||||||
|
|
|
@ -275,14 +275,26 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
const mentions = postContentRef.getElementsByClassName("mention")
|
const mentions = postContentRef.getElementsByClassName("mention")
|
||||||
for (const mentionElement of Array.from(mentions)) {
|
for (const mentionElement of Array.from(mentions)) {
|
||||||
mentionElement.addEventListener("click", (event: Event) => {
|
const mention = props.post.mentions
|
||||||
event.preventDefault()
|
.find((mention) => mention.url === mentionElement.getAttribute("href"))
|
||||||
const mention = props.post.mentions
|
if (mention) {
|
||||||
.find((mention) => mention.url === mentionElement.getAttribute("href"))
|
mentionElement.addEventListener("click", (event: Event) => {
|
||||||
if (mention) {
|
event.preventDefault()
|
||||||
router.push({ name: "profile", params: { profileId: mention.id } })
|
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