Skip to content

Commit fdbbe98

Browse files
committed
🐛 Fix annotation edit field overwrite and add IME composition guard
- Conditionally spread only defined fields in handleEditAnnotation to prevent undefined values from wiping sibling fields - Add !e.nativeEvent.isComposing guard to Cmd/Ctrl+Enter handlers in comment and suggested-code textareas for CJK input support
1 parent 8a6e9a6 commit fdbbe98

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/review-editor/App.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ const ReviewApp: React.FC = () => {
290290
originalCode?: string
291291
) => {
292292
setAnnotations(prev => prev.map(ann =>
293-
ann.id === id ? { ...ann, text, suggestedCode, originalCode } : ann
293+
ann.id === id ? {
294+
...ann,
295+
...(text !== undefined && { text }),
296+
...(suggestedCode !== undefined && { suggestedCode }),
297+
...(originalCode !== undefined && { originalCode }),
298+
} : ann
294299
));
295300
}, []);
296301

packages/review-editor/components/AnnotationToolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const AnnotationToolbar: React.FC<AnnotationToolbarProps> = ({
7575
onKeyDown={(e) => {
7676
if (e.key === 'Escape') {
7777
onDismiss();
78-
} else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
78+
} else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && !e.nativeEvent.isComposing) {
7979
onSubmit();
8080
}
8181
}}
@@ -107,7 +107,7 @@ export const AnnotationToolbar: React.FC<AnnotationToolbarProps> = ({
107107
onKeyDown={(e) => {
108108
if (e.key === 'Tab') {
109109
handleTabIndent(e);
110-
} else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
110+
} else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && !e.nativeEvent.isComposing) {
111111
onSubmit();
112112
}
113113
}}

0 commit comments

Comments
 (0)