|
136 | 136 | autogrow |
137 | 137 | outlined |
138 | 138 | dense |
139 | | - class="row" |
| 139 | + class="row full-width" |
140 | 140 | placeholder="Leave a comment" |
141 | | - style="width: 100%" |
142 | 141 | :disable="viewerPermission" |
| 142 | + @keydown.enter="handleComment" |
143 | 143 | > |
144 | 144 | <template #append> |
145 | 145 | <q-btn |
|
148 | 148 | flat |
149 | 149 | icon="send" |
150 | 150 | color="primary" |
| 151 | + tabindex="-1" |
151 | 152 | @click="handleComment" |
152 | 153 | /> |
153 | 154 | </template> |
|
263 | 264 | </template> |
264 | 265 |
|
265 | 266 | <script setup lang="ts"> |
266 | | -import { computed, ref, watch, nextTick } from 'vue'; |
267 | | -import { ChangeItem, Status, Profile, Enums } from 'src/types'; |
| 267 | +import { useQuasar } from 'quasar'; |
268 | 268 | import { |
269 | 269 | hideChanges, |
270 | 270 | insertComment, |
271 | 271 | updateChange, |
272 | 272 | } from 'src/api/supabaseHelper'; |
273 | | -import { useSelectedChangeStore } from 'src/stores/useSelectedChangeStore'; |
274 | | -import { useQuasar } from 'quasar'; |
275 | 273 | import { useUserStore } from 'src/stores/userStore'; |
| 274 | +import { useSelectedChangeStore } from 'src/stores/useSelectedChangeStore'; |
| 275 | +import { ChangeItem, Enums, Profile, Status } from 'src/types'; |
276 | 276 | import { MAX_EMAIL_LENGTH } from 'src/utils/consts'; |
| 277 | +import { computed, nextTick, ref, watch } from 'vue'; |
277 | 278 |
|
278 | 279 | const $quasar = useQuasar(); |
279 | 280 | const userStore = useUserStore(); |
@@ -369,12 +370,12 @@ const previewItem = computed(() => { |
369 | 370 | }); |
370 | 371 |
|
371 | 372 | async function handleComment() { |
372 | | - if (toSendComment.value.length > 0) { |
| 373 | + if (toSendComment.value.trim().length > 0) { |
373 | 374 | await insertComment( |
374 | 375 | props.item.id, |
375 | 376 | userId.value, |
376 | 377 | props.item.article_id as string, |
377 | | - toSendComment.value, |
| 378 | + toSendComment.value.trim(), |
378 | 379 | ); |
379 | 380 | toSendComment.value = ''; |
380 | 381 | } |
|
0 commit comments