Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): prevent duplicate quotes from dead keys #12644

ClosedSpizzyCoder(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12644/headopened View on GitHub

Showing 1 changed file with 12 additions and 0 deletions.

x
0 of 1 viewed, 1 left
12 additions and 0 deletionsapps/web/src/components/ComposerPromptEditorTiptap.tsxModified
View file
@@ -914,6 +914,18 @@
return handled;
handleTextInput: (view, from, to, text) => {
+ // Dead keys can replace a composition range without a user selection.
+ // Only surround explicitly selected text; let native composition finish.
+ const selection = view.state.selection;
+ if (
+ view.composing ||
+ !(selection instanceof TextSelection) ||
+ selection.empty ||
+ selection.from !== from ||
+ selection.to !== to
+ ) {
+ return false;
+ }
if (text.length !== 1) return false;
const closer = SURROUND_CLOSE[text];
if (!closer || from === to) return false;