fix: support "ctrl+enter" as send shortcuts #244

This commit is contained in:
kangfenmao 2024-12-10 17:09:57 +08:00
parent b5a109401c
commit c0f192c6f2
3 changed files with 8 additions and 2 deletions

View File

@ -183,6 +183,11 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
sendMessage()
return event.preventDefault()
}
if (sendMessageShortcut === 'Ctrl+Enter' && isEnterPressed && event.ctrlKey) {
sendMessage()
return event.preventDefault()
}
}
const addNewTopic = useCallback(async () => {

View File

@ -351,7 +351,8 @@ const SettingsTab: FC<Props> = (props) => {
menuItemSelectedIcon={<CheckOutlined />}
options={[
{ value: 'Enter', label: 'Enter' },
{ value: 'Shift+Enter', label: `Shift + Enter` }
{ value: 'Shift+Enter', label: `Shift + Enter` },
{ value: 'Ctrl+Enter', label: `Ctrl + Enter` }
]}
onChange={(value) => setSendMessageShortcut(value)}
style={{ width: 135 }}

View File

@ -2,7 +2,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { TRANSLATE_PROMPT } from '@renderer/config/prompts'
import { CodeStyleVarious, LanguageVarious, ThemeMode } from '@renderer/types'
export type SendMessageShortcut = 'Enter' | 'Shift+Enter'
export type SendMessageShortcut = 'Enter' | 'Shift+Enter' | 'Ctrl+Enter'
export interface SettingsState {
showAssistants: boolean