ime.textUpdate event
输入法请求对当前文本执行有界替换。guest 应用操作后用 updateState() 回传权威状态。
Event payload
{
handle,
update: { range: { start, end }, text: bounded-string },
baseRevision: u64
}
Examples
host.events.on('ime.textUpdate', async ({ handle, update, baseRevision }) => {
if (handle !== session || baseRevision !== editor.revision) return;
editor.replace(update.range, update.text);
await host.ime.updateState(session, editor.snapshot());
});
Delivery rules
范围以该 revision 的文本为基准。宿主不能把过期编辑静默套到新文本;guest 也不能只更新 UI 而不确认状态。