diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c7e96e1444..7e19f60091 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -797,6 +797,7 @@ translatedFrom: "{x}から翻訳" accountDeletionInProgress: "アカウントの削除が進行中です" usernameInfo: "サーバー上であなたのアカウントを一意に識別するための名前。アルファベット(a~z, A~Z)、数字(0~9)、およびアンダーバー(_)が使用できます。ユーザー名は後から変更することは出来ません。" aiChanMode: "藍モード" +enterSendsMessage: "メッセージングでReturnキーを押すと、メッセージが送信されます(デフォルトはCtrl + Returnです)" keepCw: "CWを維持する" pubSub: "Pub/Subのアカウント" lastCommunication: "直近の通信" diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 3385e8fba9..096f07fb4a 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -125,8 +125,21 @@ function onDrop(ev: DragEvent): void { function onKeydown(ev: KeyboardEvent) { typing(); - if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey) && canSend) { - send(); + 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.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 ff7c7559db..13f4eaf8ec 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 }} @@ -142,6 +143,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')); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 32423d5e2c..911807f0f0 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -255,6 +255,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: false, }, + enterSendsMessage: { + where: 'device', + default: false, + }, })); // TODO: 他のタブと永続化されたstateを同期