Skip to content

Commit

Permalink
[8.15] Fix support for IME in Assistant prompt (#184874) (#188384)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.15`:
- [Fix support for IME in Assistant prompt
(#184874)](#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":"[email protected]"},"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\nhttps://github.com/elastic/kibana/assets/5188868/f0ff388f-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by:
Garrett Spong
<[email protected]>","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\nhttps://github.com/elastic/kibana/assets/5188868/f0ff388f-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by:
Garrett Spong
<[email protected]>","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\nhttps://github.com/elastic/kibana/assets/5188868/f0ff388f-3943-4382-a873-88949b760629\r\n\r\n---------\r\n\r\nCo-authored-by:
Garrett Spong
<[email protected]>","sha":"87f0e71d193ec77912cc4b99f52cc7fdcf2dc4bc"}}]}]
BACKPORT-->

Co-authored-by: Patryk Kopyciński <[email protected]>
  • Loading branch information
kibanamachine and patrykkopycinski authored Jul 16, 2024
1 parent c2ae24f commit b0d4adb
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b0d4adb

Please sign in to comment.