diff --git a/locales/index.d.ts b/locales/index.d.ts index 0fcfcee7e5..b0da7915dc 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5448,6 +5448,14 @@ export interface Locale extends ILocale { * ホーム */ "home": string; + /** + * 送信 + */ + "send": string; + /** + * 改行 + */ + "newline": string; /** * このルームをミュート */ @@ -5614,11 +5622,23 @@ export interface Locale extends ILocale { * ナビゲーションバーに副ボタンを表示 */ "showNavbarSubButtons": string; + /** + * オンのとき + */ + "ifOn": string; + /** + * オフのとき + */ + "ifOff": string; "_chat": { /** * 送信者の名前を表示 */ "showSenderName": string; + /** + * Enterで送信 + */ + "sendOnEnter": string; }; }; "_preferencesProfile": { diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e770d04768..b95adb1871 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1359,6 +1359,8 @@ _chat: members: "メンバー" searchMessages: "メッセージを検索" home: "ホーム" + send: "送信" + newline: "改行" muteThisRoom: "このルームをミュート" deleteRoom: "ルームを削除" cannotChatWithTheUser: "このユーザーとのチャットを開始できません" @@ -1404,9 +1406,12 @@ _settings: makeEveryTextElementsSelectable: "全てのテキスト要素を選択可能にする" makeEveryTextElementsSelectable_description: "有効にすると、一部のシチュエーションでのユーザビリティが低下する場合があります。" showNavbarSubButtons: "ナビゲーションバーに副ボタンを表示" + ifOn: "オンのとき" + ifOff: "オフのとき" _chat: showSenderName: "送信者の名前を表示" + sendOnEnter: "Enterで送信" _preferencesProfile: profileName: "プロファイル名" diff --git a/packages/frontend/src/pages/chat/room.form.vue b/packages/frontend/src/pages/chat/room.form.vue index aba9d6061f..27ddbeb565 100644 --- a/packages/frontend/src/pages/chat/room.form.vue +++ b/packages/frontend/src/pages/chat/room.form.vue @@ -151,8 +151,16 @@ function onDrop(ev: DragEvent): void { } function onKeydown(ev: KeyboardEvent) { - if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey)) { - send(); + if (ev.key === 'Enter') { + if (prefer.s['chat.sendOnEnter']) { + if (!(ev.ctrlKey || ev.metaKey || ev.shiftKey)) { + send(); + } + } else { + if ((ev.ctrlKey || ev.metaKey)) { + send(); + } + } } } diff --git a/packages/frontend/src/pages/settings/preferences.vue b/packages/frontend/src/pages/settings/preferences.vue index 3a7d2cd490..816f8d7435 100644 --- a/packages/frontend/src/pages/settings/preferences.vue +++ b/packages/frontend/src/pages/settings/preferences.vue @@ -434,7 +434,7 @@ SPDX-License-Identifier: AGPL-3.0-only <template #label><SearchLabel>{{ i18n.ts.chat }}</SearchLabel></template> <template #icon><i class="ti ti-messages"></i></template> - <div class="_gaps_m"> + <div class="_gaps_s"> <SearchMarker :keywords="['show', 'sender', 'name']"> <MkPreferenceContainer k="chat.showSenderName"> <MkSwitch v-model="chatShowSenderName"> @@ -442,6 +442,28 @@ SPDX-License-Identifier: AGPL-3.0-only </MkSwitch> </MkPreferenceContainer> </SearchMarker> + + <SearchMarker :keywords="['send', 'enter', 'newline']"> + <MkPreferenceContainer k="chat.sendOnEnter"> + <MkSwitch v-model="chatSendOnEnter"> + <template #label><SearchLabel>{{ i18n.ts._settings._chat.sendOnEnter }}</SearchLabel></template> + <template #caption> + <div class="_gaps_s"> + <div> + <b>{{ i18n.ts._settings.ifOn }}:</b> + <div>{{ i18n.ts._chat.send }}: Enter</div> + <div>{{ i18n.ts._chat.newline }}: Shift + Enter</div> + </div> + <div> + <b>{{ i18n.ts._settings.ifOff }}:</b> + <div>{{ i18n.ts._chat.send }}: Ctrl + Enter</div> + <div>{{ i18n.ts._chat.newline }}: Enter</div> + </div> + </div> + </template> + </MkSwitch> + </MkPreferenceContainer> + </SearchMarker> </div> </MkFolder> </SearchMarker> @@ -627,6 +649,7 @@ const useBlurEffectForModal = prefer.model('useBlurEffectForModal'); const useBlurEffect = prefer.model('useBlurEffect'); const defaultFollowWithReplies = prefer.model('defaultFollowWithReplies'); const chatShowSenderName = prefer.model('chat.showSenderName'); +const chatSendOnEnter = prefer.model('chat.sendOnEnter'); watch(lang, () => { miLocalStorage.setItem('lang', lang.value as string); @@ -654,6 +677,7 @@ watch([ squareAvatars, highlightSensitiveMedia, enableSeasonalScreenEffect, + chatShowSenderName, ], async () => { await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true }); }); diff --git a/packages/frontend/src/preferences/def.ts b/packages/frontend/src/preferences/def.ts index 801bb29e8c..b588cc3b5f 100644 --- a/packages/frontend/src/preferences/def.ts +++ b/packages/frontend/src/preferences/def.ts @@ -377,6 +377,9 @@ export const PREF_DEF = { 'chat.showSenderName': { default: false, }, + 'chat.sendOnEnter': { + default: false, + }, 'game.dropAndFusion': { default: { diff --git a/packages/frontend/src/utility/autogen/settings-search-index.ts b/packages/frontend/src/utility/autogen/settings-search-index.ts index 1e41dffe22..c939c93425 100644 --- a/packages/frontend/src/utility/autogen/settings-search-index.ts +++ b/packages/frontend/src/utility/autogen/settings-search-index.ts @@ -491,55 +491,60 @@ export const searchIndexes: SearchIndexItem[] = [ label: i18n.ts._settings._chat.showSenderName, keywords: ['show', 'sender', 'name'], }, + { + id: 'omEy5Q3Ev', + label: i18n.ts._settings._chat.sendOnEnter, + keywords: ['send', 'enter', 'newline'], + }, ], label: i18n.ts.chat, keywords: ['chat', 'messaging'], }, { - id: 'sCscGhMmH', + id: '5fy7VEy6i', children: [ { - id: 'dLkRNHn3k', + id: 'EosiWZvak', label: i18n.ts.squareAvatars, keywords: ['avatar', 'icon', 'square'], }, { - id: 'BvooTWFW5', + id: 'qY5xTzl35', label: i18n.ts.seasonalScreenEffect, keywords: ['effect', 'show'], }, { - id: 'yzbghkAq0', + id: '2VSnj81vC', label: i18n.ts.openImageInNewTab, keywords: ['image', 'photo', 'picture', 'media', 'thumbnail', 'new', 'tab'], }, { - id: 'aSbKFHbOy', + id: 'hdQa7W2H1', label: i18n.ts.withRepliesByDefaultForNewlyFollowed, keywords: ['follow', 'replies'], }, { - id: '89bn97UgY', + id: 'nnj4DkjhP', label: i18n.ts.whenServerDisconnected, keywords: ['server', 'disconnect', 'reconnect', 'reload', 'streaming'], }, { - id: 'hgf3rgdA6', + id: 'Eh7vTluDO', label: i18n.ts.numberOfPageCache, keywords: ['cache', 'page'], }, { - id: '6FVdHPhhv', + id: 'vTRSKf1JA', label: i18n.ts.forceShowAds, keywords: ['ad', 'show'], }, { - id: '5Bx5DAST1', + id: 'dwhQfcLGt', label: i18n.ts.hemisphere, keywords: [], }, { - id: 'wv7Cwiwb1', + id: 'Ar1lj7f7U', label: i18n.ts.additionalEmojiDictionary, keywords: ['emoji', 'dictionary', 'additional', 'extra'], },