feat: implemnt reply to specific post with quote

This commit is contained in:
2025-11-10 20:09:11 +02:00
parent e8f95dcd7c
commit 1ea03d5f65
3 changed files with 32 additions and 4 deletions

View File

@@ -124,7 +124,7 @@ export default defineComponent({
isEditing: false,
strings: {
edited: t('forum', 'Edited'),
reply: t('forum', 'Reply'),
reply: t('forum', 'Quote Reply'),
edit: t('forum', 'Edit'),
delete: t('forum', 'Delete'),
confirmDelete: t(

View File

@@ -142,6 +142,11 @@ export default defineComponent({
textarea.$el.querySelector('textarea').focus()
}
},
setQuotedContent(contentRaw: string): void {
// Set the textarea content with a quoted version of the provided content
this.content = `[quote]${contentRaw}[/quote]\n`
},
},
})
</script>

View File

@@ -403,9 +403,32 @@ export default defineComponent({
},
handleReply(post: Post): void {
console.log('Reply to post:', post.id)
// TODO: Implement reply functionality
// Could open a reply form or navigate to a reply page
const replyForm = this.$refs.replyForm as any
if (!replyForm) {
return
}
// Set the quoted content in the reply form
if (replyForm && typeof replyForm.setQuotedContent === 'function') {
replyForm.setQuotedContent(post.contentRaw)
}
// Scroll to the reply form with smooth behavior
const element = replyForm.$el as HTMLElement
if (element) {
element.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
inline: 'nearest',
})
}
// Wait for scroll animation to complete before focusing
setTimeout(() => {
if (replyForm && typeof replyForm.focus === 'function') {
replyForm.focus()
}
}, 500)
},
setPostCardRef(el: any, postId: number) {