diff --git a/page/client.ts b/page/client.ts index 0cdc19d..6302742 100644 --- a/page/client.ts +++ b/page/client.ts @@ -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 +} diff --git a/page/focus.ts b/page/focus.ts index 8f53fd1..44de218 100644 --- a/page/focus.ts +++ b/page/focus.ts @@ -1,4 +1,5 @@ import Module from './module' +import { resetPreedit } from './client' type Input = HTMLInputElement | HTMLTextAreaElement @@ -28,6 +29,7 @@ export function blur() { } input = null Module.ccall('focus_out', 'void', [], []) + resetPreedit() } export function getInputElement(): Input | null {