The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 08:15 UTC
fix: paste-as-text shortcut on non-Latin layouts (#28470)
ValeraZSD committed
Nov 1, 2026 at 22:53 UTC
2101c6f619ef681e288b6a6f80310d63544cfa1d
2 files changed
+22
-2
packages/client-runtime/src/textPaste.test.ts
new
+12
@@ -0,0 +1,12 @@
1
+import { describe, expect, it } from "vite-plus/test";
2
+
3
+import { isPasteAsTextShortcut } from "./textPaste.ts";
4
+
5
+describe("isPasteAsTextShortcut", () => {
6
+ it("accepts the V key on non-Latin layouts but follows the letter on Latin ones", () => {
7
+ const chord = { metaKey: false, ctrlKey: true, shiftKey: true, altKey: false };
8
+ expect(isPasteAsTextShortcut({ ...chord, key: "М", code: "KeyV" }, false)).toBe(true);
9
+ expect(isPasteAsTextShortcut({ ...chord, key: "k", code: "KeyV" }, false)).toBe(false);
10
+ expect(isPasteAsTextShortcut({ ...chord, key: "V", code: "Period" }, false)).toBe(true);
11
+ });
12
+});
packages/client-runtime/src/textPaste.ts
+10
-2
@@ -4,12 +4,20 @@ const textEncoder = new TextEncoder();
4
5
export type PastedTextDisposition = "attachment" | "inline";
6
7
+/** Non-Latin layouts (Cyrillic, Greek) report the typed letter; fall back to the physical key. */
8
+function isVKey(event: { readonly key: string; readonly code?: string }): boolean {
9
+ const key = event.key.toLowerCase();
10
+ return /^[a-z]$/.test(key) ? key === "v" : event.code === "KeyV";
11
+}
12
+
13
export function isPasteAsTextShortcut(
8
- event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey">,
14
+ event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey"> & {
15
+ readonly code?: string;
16
+ },
17
macPlatform: boolean,
18
): boolean {
19
return (
12
- event.key.toLowerCase() === "v" &&
20
+ isVKey(event) &&
21
event.shiftKey &&
22
!event.altKey &&
23
(macPlatform ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey)