Skip to content

Commit

Permalink
reset preedit state on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Sep 5, 2024
1 parent 8e81cca commit 8c00aee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions page/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ export function setPreedit(text: string, index: number) {
export function commit(text: string) {
changeInput(text, '', 0)
}

export function resetPreedit() {
preedit = ''
preeditIndex = 0
}
2 changes: 2 additions & 0 deletions page/focus.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Module from './module'
import { resetPreedit } from './client'

type Input = HTMLInputElement | HTMLTextAreaElement

Expand Down Expand Up @@ -28,6 +29,7 @@ export function blur() {
}
input = null
Module.ccall('focus_out', 'void', [], [])
resetPreedit()
}

export function getInputElement(): Input | null {
Expand Down

0 comments on commit 8c00aee

Please sign in to comment.