Skip to content

Commit f9c0344

Browse files
authored
press enter to send comment (#674)
* press enter to send comment * prevent tab navigation to "send" comment button
1 parent 719cbf8 commit f9c0344

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

frontend/src/components/Diff/DiffItem.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@
136136
autogrow
137137
outlined
138138
dense
139-
class="row"
139+
class="row full-width"
140140
placeholder="Leave a comment"
141-
style="width: 100%"
142141
:disable="viewerPermission"
142+
@keydown.enter="handleComment"
143143
>
144144
<template #append>
145145
<q-btn
@@ -148,6 +148,7 @@
148148
flat
149149
icon="send"
150150
color="primary"
151+
tabindex="-1"
151152
@click="handleComment"
152153
/>
153154
</template>
@@ -263,17 +264,17 @@
263264
</template>
264265

265266
<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';
268268
import {
269269
hideChanges,
270270
insertComment,
271271
updateChange,
272272
} from 'src/api/supabaseHelper';
273-
import { useSelectedChangeStore } from 'src/stores/useSelectedChangeStore';
274-
import { useQuasar } from 'quasar';
275273
import { useUserStore } from 'src/stores/userStore';
274+
import { useSelectedChangeStore } from 'src/stores/useSelectedChangeStore';
275+
import { ChangeItem, Enums, Profile, Status } from 'src/types';
276276
import { MAX_EMAIL_LENGTH } from 'src/utils/consts';
277+
import { computed, nextTick, ref, watch } from 'vue';
277278
278279
const $quasar = useQuasar();
279280
const userStore = useUserStore();
@@ -369,12 +370,12 @@ const previewItem = computed(() => {
369370
});
370371
371372
async function handleComment() {
372-
if (toSendComment.value.length > 0) {
373+
if (toSendComment.value.trim().length > 0) {
373374
await insertComment(
374375
props.item.id,
375376
userId.value,
376377
props.item.article_id as string,
377-
toSendComment.value,
378+
toSendComment.value.trim(),
378379
);
379380
toSendComment.value = '';
380381
}

0 commit comments

Comments
 (0)