mirror of https://github.com/buster-so/buster.git
add shift enter ability
This commit is contained in:
parent
352bd0b906
commit
6719efbd49
|
@ -15,6 +15,7 @@ import type {
|
|||
MentionInputSuggestionsRef,
|
||||
} from '@/components/ui/inputs/MentionInputSuggestions';
|
||||
import { MentionInputSuggestions } from '@/components/ui/inputs/MentionInputSuggestions';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { useMemoizedFn } from '@/hooks/useMemoizedFn';
|
||||
import { useMount } from '@/hooks/useMount';
|
||||
import { NewShortcutModal } from '../../modals/NewShortcutModal';
|
||||
|
@ -52,6 +53,7 @@ export const BusterChatInputBase: React.FC<BusterChatInputProps> = React.memo(
|
|||
const uniqueSuggestions = useUniqueSuggestions(suggestedPrompts);
|
||||
const [openCreateShortcutModal, setOpenCreateShortcutModal] = useState(false);
|
||||
const [mode, setMode] = useState<MessageAnalysisMode>('auto');
|
||||
const { openInfoMessage } = useBusterNotifications();
|
||||
|
||||
const shortcutsSuggestions = useShortcutsSuggestions(
|
||||
shortcuts,
|
||||
|
@ -96,8 +98,9 @@ export const BusterChatInputBase: React.FC<BusterChatInputProps> = React.memo(
|
|||
return;
|
||||
}
|
||||
|
||||
if (disabled || !value) {
|
||||
if (disabled || !value || !value.transformedValue) {
|
||||
console.warn('Input is disabled or value is not defined');
|
||||
openInfoMessage('Please enter a question or type ‘/’ for shortcuts...');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@ export const SubmitOnEnter = ({
|
|||
}
|
||||
return !!onPressEnter;
|
||||
},
|
||||
'Shift-Enter': () => this.editor.commands.newlineInCode(), // or insert a break
|
||||
'Shift-Enter': ({ editor }) => {
|
||||
editor.commands.splitBlock();
|
||||
return true;
|
||||
}, // or insert a break
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue