Skip to content

Commit a778fef

Browse files
authored
Merge pull request #7884 from nextcloud/backport/7878/stable33
[stable33] fix(comments): use message source when updating a message
2 parents aa29b0f + 2081f9f commit a778fef

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

src/components/card/CommentForm.vue

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
:maxlength="1000"
1111
:user-data="members"
1212
@submit="submit" />
13+
<NcButton v-show="hasContent"
14+
type="tertiary"
15+
:aria-label="t('deck', 'Submit')"
16+
:title="t('deck', 'Submit')"
17+
class="comment-form__submit"
18+
@click="submit">
19+
<template #icon>
20+
<ArrowRightIcon :size="20" />
21+
</template>
22+
</NcButton>
1323
<p v-if="error">
1424
{{ error }}
1525
</p>
@@ -18,11 +28,14 @@
1828

1929
<script>
2030
import { mapState } from 'vuex'
21-
import { NcRichContenteditable } from '@nextcloud/vue'
31+
import { NcButton, NcRichContenteditable } from '@nextcloud/vue'
32+
import ArrowRightIcon from 'vue-material-design-icons/ArrowRight.vue'
2233
2334
export default {
2435
name: 'CommentForm',
2536
components: {
37+
ArrowRightIcon,
38+
NcButton,
2639
NcRichContenteditable,
2740
},
2841
props: {
@@ -53,6 +66,9 @@ export default {
5366
})
5467
return obj
5568
},
69+
hasContent() {
70+
return this.commentText.trim().length > 0
71+
},
5672
},
5773
watch: {
5874
value(val) {
@@ -98,4 +114,20 @@ export default {
98114
[class*="_tribute-container-autocomplete_"] {
99115
z-index: 9999 !important;
100116
}
117+
118+
.comment-form {
119+
position: relative;
120+
121+
.comment-form__submit {
122+
position: absolute;
123+
bottom: var(--default-grid-baseline);
124+
inset-inline-end: var(--default-grid-baseline);
125+
z-index: 1;
126+
}
127+
128+
// Add padding to prevent text from going under the button
129+
:deep(.rich-content-editor__input) {
130+
padding-inline-end: calc(var(--default-clickable-area) + var(--default-grid-baseline));
131+
}
132+
}
101133
</style>

src/components/card/CommentItem.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ export default {
183183
},
184184
showUpdateForm() {
185185
this.edit = true
186-
this.$nextTick(() => {
187-
this.commentMsg = this.$refs.richTextElement.children[0].innerHTML
188-
})
186+
this.commentMsg = this.comment.message
189187
},
190188
hideUpdateForm() {
191189
this.commentMsg = ''

0 commit comments

Comments
 (0)