Skip to content

Commit 7754d23

Browse files
committed
fix: prevent Enter from sending message during IME composition (fix #18), fix tsconfig ignoreDeprecations error (fix #17)
- Add event.isComposing check in keydown handler to prevent accidental message send when pressing Enter during Chinese IME input (closes #18) - Remove invalid ignoreDeprecations: "6.0" from tsconfig.json which caused TS5103 error with TypeScript 5.9 (closes #17) - Update package-lock.json after npm install
1 parent aabfa81 commit 7754d23

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/webview.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@
2727
</div>
2828
</div>
2929
<button class="header-new-btn" id="newSessionBtn" title="New chat">
30-
<svg
31-
class="header-new-icon"
32-
viewBox="0 0 1024 1024"
33-
width="16"
34-
height="16"
35-
aria-hidden="true"
36-
>
30+
<svg class="header-new-icon" viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true">
3731
<path d="M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"></path>
3832
<path d="M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"></path>
3933
</svg>
@@ -1699,6 +1693,10 @@
16991693
}
17001694

17011695
if (event.key === "Enter") {
1696+
if (event.isComposing) {
1697+
// 输入法组合中(如中文输入法选字),不处理回车
1698+
return;
1699+
}
17021700
if (event.shiftKey) {
17031701
// Shift+回车:允许换行(默认行为)
17041702
return;

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"target": "ES2022",
44
"module": "ESNext",
55
"moduleResolution": "bundler",
6-
"ignoreDeprecations": "6.0",
76
"lib": ["ES2022"],
87
"strict": true,
98
"esModuleInterop": true,

0 commit comments

Comments
 (0)