Skip to content

Commit

Permalink
pref: compositionend
Browse files Browse the repository at this point in the history
  • Loading branch information
ourongxing committed Jun 14, 2023
1 parent ca456a9 commit 8ff3811
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions src/components/Chat/InputBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { makeEventListener } from "@solid-primitives/event-listener"
import { Fzf } from "fzf"
import throttle from "just-throttle"
import {
Expand Down Expand Up @@ -45,25 +44,6 @@ export default function ({
selector: k => `${k.title}\n${k.desc}`
})
})
if (store.inputRef) {
makeEventListener(
store.inputRef,
"compositionend",
() => {
setCompositionend(true)
handleInput()
},
{ passive: true }
)
makeEventListener(
store.inputRef,
"compositionstart",
() => {
setCompositionend(false)
},
{ passive: true }
)
}
})

function setSuitableheight() {
Expand Down Expand Up @@ -134,7 +114,7 @@ export default function ({
)
}
},
100,
200,
{
trailing: false,
leading: true
Expand Down Expand Up @@ -229,6 +209,13 @@ export default function ({
}
}}
onInput={handleInput}
onCompositionStart={() => {
setCompositionend(false)
}}
onCompositionEnd={() => {
setCompositionend(true)
handleInput()
}}
style={{
height: height() + "px"
}}
Expand Down

0 comments on commit 8ff3811

Please sign in to comment.