mirror of
https://github.com/paricafe/misskey.git
synced 2025-03-31 14:29:28 -05:00
enhance(frontend): Enterでチャットのメッセージを送信できるように
This commit is contained in:
parent
8c1fc85d00
commit
2272eceffa
6 changed files with 78 additions and 13 deletions
locales
packages/frontend/src
pages
preferences
utility/autogen
20
locales/index.d.ts
vendored
20
locales/index.d.ts
vendored
|
@ -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": {
|
||||
|
|
|
@ -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: "プロファイル名"
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 });
|
||||
});
|
||||
|
|
|
@ -377,6 +377,9 @@ export const PREF_DEF = {
|
|||
'chat.showSenderName': {
|
||||
default: false,
|
||||
},
|
||||
'chat.sendOnEnter': {
|
||||
default: false,
|
||||
},
|
||||
|
||||
'game.dropAndFusion': {
|
||||
default: {
|
||||
|
|
|
@ -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'],
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue