Use `Enter` on slash commands to execute (#334)
This commit is contained in:
parent
4a0f5476c0
commit
c4fb1ad04b
|
@ -60,6 +60,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||||
const base = query.substring(0, slashIndex + 1);
|
const base = query.substring(0, slashIndex + 1);
|
||||||
const newValue = base + selectedSuggestion.value;
|
const newValue = base + selectedSuggestion.value;
|
||||||
onChangeAndMoveCursor(newValue);
|
onChangeAndMoveCursor(newValue);
|
||||||
|
onSubmit(newValue); // Execute the command
|
||||||
} else {
|
} else {
|
||||||
// Handle @ command completion
|
// Handle @ command completion
|
||||||
const atIndex = query.lastIndexOf('@');
|
const atIndex = query.lastIndexOf('@');
|
||||||
|
@ -85,7 +86,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||||
|
|
||||||
resetCompletion(); // Hide suggestions after selection
|
resetCompletion(); // Hide suggestions after selection
|
||||||
},
|
},
|
||||||
[query, suggestions, resetCompletion, onChangeAndMoveCursor],
|
[query, suggestions, resetCompletion, onChangeAndMoveCursor, onSubmit],
|
||||||
);
|
);
|
||||||
|
|
||||||
const inputPreprocessor = useCallback(
|
const inputPreprocessor = useCallback(
|
||||||
|
|
Loading…
Reference in New Issue