Skip to content

Commit

Permalink
🍎 fix: Update "Enter to send" behavior for Mac users (danny-avila#4539)
Browse files Browse the repository at this point in the history
* fix: Update useTextarea to handle Ctrl+Enter on Mac

* fix: Update language files for message sending behavior
  • Loading branch information
danny-avila authored and olivierhub committed Oct 25, 2024
1 parent 8677080 commit 2a7e33b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/hooks/Input/useTextarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default function useTextarea({
checkHealth();

const isNonShiftEnter = e.key === 'Enter' && !e.shiftKey;
const isCtrlEnter = e.key === 'Enter' && e.ctrlKey;
const isCtrlEnter = e.key === 'Enter' && (e.ctrlKey || e.metaKey);

if (isNonShiftEnter && filesLoading) {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion client/src/localization/languages/Br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ export default {
com_nav_voice_select: 'Voz',
com_nav_enable_cloud_browser_voice: 'Usar vozes baseadas na nuvem',
com_nav_info_enter_to_send:
'Quando habilitado, pressionar `ENTER` enviará sua mensagem. Quando desabilitado, pressionar Enter adicionará uma nova linha, e você precisará pressionar `CTRL + ENTER` para enviar sua mensagem.',
'Quando habilitado, pressionar `ENTER` enviará sua mensagem. Quando desabilitado, pressionar Enter adicionará uma nova linha, e você precisará pressionar `CTRL + ENTER` / `⌘ + ENTER` para enviar sua mensagem.',
com_nav_info_save_draft:
'Quando habilitado, o texto e os anexos que você inserir no formulário de chat serão salvos automaticamente localmente como rascunhos. Esses rascunhos estarão disponíveis mesmo se você recarregar a página ou mudar para uma conversa diferente. Os rascunhos são armazenados localmente no seu dispositivo e são excluídos uma vez que a mensagem é enviada.',
com_nav_info_fork_change_default:
Expand Down
2 changes: 1 addition & 1 deletion client/src/localization/languages/Eng.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ export default {
com_nav_voice_select: 'Voice',
com_nav_enable_cloud_browser_voice: 'Use cloud-based voices',
com_nav_info_enter_to_send:
'When enabled, pressing `ENTER` will send your message. When disabled, pressing Enter will add a new line, and you\'ll need to press `CTRL + ENTER` to send your message.',
'When enabled, pressing `ENTER` will send your message. When disabled, pressing Enter will add a new line, and you\'ll need to press `CTRL + ENTER` / `⌘ + ENTER` to send your message.',
com_nav_info_save_draft:
'When enabled, the text and attachments you enter in the chat form will be automatically saved locally as drafts. These drafts will be available even if you reload the page or switch to a different conversation. Drafts are stored locally on your device and are deleted once the message is sent.',
com_nav_info_fork_change_default:
Expand Down
2 changes: 1 addition & 1 deletion client/src/localization/languages/Jp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ export default {
com_nav_voice_select: '音声',
com_nav_enable_cloud_browser_voice: 'クラウドベースの音声を使用',
com_nav_info_enter_to_send:
'有効になっている場合、 `ENTER` キーを押すとメッセージが送信されます。無効になっている場合、Enterキーを押すと新しい行が追加され、 `CTRL + ENTER` キーを押してメッセージを送信する必要があります。',
'有効になっている場合、 `ENTER` キーを押すとメッセージが送信されます。無効になっている場合、Enterキーを押すと新しい行が追加され、 `CTRL + ENTER` / `⌘ + ENTER` キーを押してメッセージを送信する必要があります。',
com_nav_info_save_draft:
'有効になっている場合、チャットフォームに入力したテキストと添付ファイルがドラフトとしてローカルに自動保存されます。これらのドラフトは、ページをリロードしたり、別の会話に切り替えても利用できます。ドラフトはデバイスにローカルに保存され、メッセージが送信されると削除されます。',
com_nav_info_fork_change_default:
Expand Down
2 changes: 1 addition & 1 deletion client/src/localization/languages/Zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ export default {
com_nav_voice_select: '语音',
com_nav_enable_cloud_browser_voice: '使用云端语音',
com_nav_info_enter_to_send:
'启用后,按下 `ENTER` 将发送您的消息。禁用后,按下 `ENTER` 将添加新行,您需要按下 `CTRL + ENTER` 来发送消息。',
'启用后,按下 `ENTER` 将发送您的消息。禁用后,按下 `ENTER` 将添加新行,您需要按下 `CTRL + ENTER` / `⌘ + ENTER` 来发送消息。',
com_nav_info_save_draft:
'启用后,您在聊天表单中输入的文本和附件将自动本地保存为草稿。即使您重新加载页面或切换到不同的对话,这些草稿也将可用。草稿存储在您设备的本地,并在消息发送后删除。',
com_nav_info_fork_change_default:
Expand Down

0 comments on commit 2a7e33b

Please sign in to comment.