mirror of
https://github.com/chenasraf/nextcloud-forum.git
synced 2026-05-18 09:38:58 +00:00
feat: implemnt reply to specific post with quote
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user