Merge pull request #41 from zonghaoyuan/fix/ime-enter-key
fix(web): prevent Enter key from firing during IME composition
This commit is contained in:
+10
-1
@@ -1610,7 +1610,11 @@ export default function HomePage() {
|
|||||||
value={prompt}
|
value={prompt}
|
||||||
onChange={(e) => setPrompt(e.target.value)}
|
onChange={(e) => setPrompt(e.target.value)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Enter" && !e.shiftKey) {
|
if (
|
||||||
|
e.key === "Enter" &&
|
||||||
|
!e.shiftKey &&
|
||||||
|
!e.nativeEvent.isComposing
|
||||||
|
) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
@@ -1638,6 +1642,11 @@ export default function HomePage() {
|
|||||||
<i className="fa-solid fa-arrow-right text-xs" />
|
<i className="fa-solid fa-arrow-right text-xs" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{prompt && (
|
||||||
|
<p className="mt-2 text-right text-xs text-clay-400">
|
||||||
|
Enter 发送 · Shift+Enter 换行
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{/* 类别选择器(居中) */}
|
{/* 类别选择器(居中) */}
|
||||||
|
|||||||
Reference in New Issue
Block a user