mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.15`: - [Fix support for IME in Assistant prompt (#184874)](https://github.com/elastic/kibana/pull/184874) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2024-07-16T00:21:59Z","message":"Fix support for IME in Assistant prompt (#184874)\n\n## Summary\r\n\r\nKudos to @sakurai-youhei for providing a fix 🙇\r\n \r\nTested on Chrome, Firefox, Safari\r\n\r\n\r\nf0ff388f
-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"87f0e71d193ec77912cc4b99f52cc7fdcf2dc4bc","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","sdh-linked","Team:Security Generative AI","v8.15.0","v8.16.0"],"title":"Fix support for IME in Assistant prompt","number":184874,"url":"https://github.com/elastic/kibana/pull/184874","mergeCommit":{"message":"Fix support for IME in Assistant prompt (#184874)\n\n## Summary\r\n\r\nKudos to @sakurai-youhei for providing a fix 🙇\r\n \r\nTested on Chrome, Firefox, Safari\r\n\r\n\r\nf0ff388f
-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"87f0e71d193ec77912cc4b99f52cc7fdcf2dc4bc"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/184874","number":184874,"mergeCommit":{"message":"Fix support for IME in Assistant prompt (#184874)\n\n## Summary\r\n\r\nKudos to @sakurai-youhei for providing a fix 🙇\r\n \r\nTested on Chrome, Firefox, Safari\r\n\r\n\r\nf0ff388f
-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by: Garrett Spong <spong@users.noreply.github.com>","sha":"87f0e71d193ec77912cc4b99f52cc7fdcf2dc4bc"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
This commit is contained in:
parent
c2ae24f1bd
commit
b0d4adb41a
1 changed files with 9 additions and 6 deletions
|
@ -30,13 +30,16 @@ export const PromptTextArea = forwardRef<HTMLTextAreaElement, Props>(
|
|||
|
||||
const onKeyDown = useCallback(
|
||||
(event) => {
|
||||
if (event.key === 'Enter' && !event.shiftKey && value.trim().length > 0) {
|
||||
// keyCode 13 is needed in case of IME input
|
||||
if (event.keyCode === 13 && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
onPromptSubmit(event.target.value?.trim());
|
||||
handlePromptChange('');
|
||||
} else if (event.key === 'Enter' && !event.shiftKey && value.trim().length === 0) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if (value.trim().length) {
|
||||
onPromptSubmit(event.target.value?.trim());
|
||||
handlePromptChange('');
|
||||
} else {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
},
|
||||
[value, onPromptSubmit, handlePromptChange]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue