fix(web-ui): ignore key events during IME composition (#2982)
* fix(web-ui): ignore key events during IME composition * fix(web-ui): ignore key events during IME composition in ModelSelector
This commit is contained in:
@@ -60,6 +60,9 @@ export class MessageEditor extends LitElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private handleKeyDown = (e: KeyboardEvent) => {
|
private handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
// Ignore key events during IME composition (e.g. CJK input)
|
||||||
|
if (e.isComposing || e.key === "Process") return;
|
||||||
|
|
||||||
if (e.key === "Enter" && !e.shiftKey) {
|
if (e.key === "Enter" && !e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!this.isStreaming && !this.processingFiles && (this.value.trim() || this.attachments.length > 0)) {
|
if (!this.isStreaming && !this.processingFiles && (this.value.trim() || this.attachments.length > 0)) {
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ export class ModelSelector extends DialogBase {
|
|||||||
|
|
||||||
// Add global keyboard handler for the dialog
|
// Add global keyboard handler for the dialog
|
||||||
this.addEventListener("keydown", (e: KeyboardEvent) => {
|
this.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||||
|
// Ignore key events during IME composition (e.g. CJK input)
|
||||||
|
if (e.isComposing || e.key === "Process") return;
|
||||||
|
|
||||||
// Get filtered models to know the bounds
|
// Get filtered models to know the bounds
|
||||||
const filteredModels = this.getFilteredModels();
|
const filteredModels = this.getFilteredModels();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user