| 2188 | }; |
| 2189 | |
| 2190 | var onCompositionUpdate = function() { |
| 2191 | if (!inComposition || !host.onCompositionUpdate || host.$readOnly) |
| 2192 | return; |
| 2193 | var val = text.value.replace(/\x01/g, ""); |
| 2194 | if (inComposition.lastValue === val) return; |
| 2195 | |
| 2196 | host.onCompositionUpdate(val); |
| 2197 | if (inComposition.lastValue) |
| 2198 | host.undo(); |
| 2199 | inComposition.lastValue = val; |
| 2200 | if (inComposition.lastValue) { |
| 2201 | var r = host.selection.getRange(); |
| 2202 | host.insert(inComposition.lastValue); |
| 2203 | host.session.markUndoGroup(); |
| 2204 | inComposition.range = host.selection.getRange(); |
| 2205 | host.selection.setRange(r); |
| 2206 | host.selection.clearSelection(); |
| 2207 | } |
| 2208 | }; |
| 2209 | |
| 2210 | var onCompositionEnd = function(e) { |
| 2211 | if (!host.onCompositionEnd || host.$readOnly) return; |