fix(diffs): Handle IME composition input - #823
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
💡 Codex ReviewWhen an edit changes the line count, this remembers the live pierre/packages/diffs/src/editor/editor.ts Lines 678 to 680 in cdff209 On browsers or embedded WebViews that do not implement ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
cdff209 to
eb3f8b3
Compare
|
Fixed by the Stale file contents on full rerenders seems to be pre-existing code in the highlight/render path, unrelated to this IME change. The suggested “update cached contents” fix risks regressing highlighting and can be tracked separately. |
yep, it's vary trick to handle selection in shadow dom.
i think this is ok. the editing won't trigger full-rerender with the stable file. |
fix(diffs): Handle IME composition input Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
fix(diffs): Handle IME composition input Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
fix(diffs): Handle IME composition input Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
fix(diffs): Handle IME composition input Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
fix(diffs): Handle IME composition input Fixes the following issue: 1. Open an editable diffs editor and place the caret in content. 2. Start a CJK IME or accented/dead-key composition. 3. Type a preview candidate, then commit it or press Esc to cancel. Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend. Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text. Also guard the selectionchange handler against browsers and embedded WebViews that lack Selection.getComposedRanges, which previously threw out of the listener on every selection change and left the editable surface unusable.
Fixes the following issue:
Previously, each preview beforeinput was prevented and warned as an unknown input type, so the browser could not show native preview text and canceled composition text could still be inserted on compositionend.
Let insertCompositionText beforeinput events stay with the browser. Track composition updates and only commit non-canceled compositionend data into the editor model. Add regression coverage for preview, commit, warning noise, and canceled composition text.