diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 0b609e0581..f0d8c8666e 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -125,12 +125,21 @@ function onDrop(ev: DragEvent): void { function onKeydown(ev: KeyboardEvent) { typing(); - if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey)) { - textEl.value += '\n'; + let sendOnEnter = localStorage.getItem('enterSendsMessage') === 'true' || defaultStore.state.enterSendsMessage; + if (sendOnEnter) { + if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey)) { + textEl.value += '\n'; + } + else if (ev.key === 'Enter' && !ev.shiftKey && !('ontouchstart' in document.documentElement) && canSend) { + ev.preventDefault(); + send(); + } } - else if (ev.key === 'Enter' && !ev.shiftKey && !('ontouchstart' in document.documentElement) && canSend) { - ev.preventDefault(); - send(); + else { + if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey) && canSend) { + ev.preventDefault(); + send(); + } } } diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index 74fa0bc926..9c3f6b3d53 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -27,6 +27,7 @@ {{ i18n.ts.openImageInNewTab }} {{ i18n.ts.enableInfiniteScroll }} {{ i18n.ts.useReactionPickerForContextMenu }} + {{ i18n.ts.enterSendsMessage }} {{ i18n.ts.disablePagesScript }} @@ -140,6 +141,7 @@ const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostF const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache')); const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker')); const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll')); +const enterSendsMessage = computed(defaultStore.makeGetterSetter('enterSendsMessage')); const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu')); const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars')); const aiChanMode = computed(defaultStore.makeGetterSetter('aiChanMode')); @@ -170,6 +172,7 @@ watch([ fontSize, useSystemFont, enableInfiniteScroll, + enterSendsMessage, squareAvatars, aiChanMode, showGapBetweenNotesInTimeline, diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index d87e05a4de..a3545c836c 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -251,6 +251,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: false, }, + enterSendsMessage: { + where: 'device', + default: false, + }, })); // TODO: 他のタブと永続化されたstateを同期