Compare commits

..

No commits in common. "48240eebe05c3182f824d8e63e05e8840a5a6097" and "aeaed88af5b5e447bd314d69d50a5d5adf710a07" have entirely different histories.

13 changed files with 40 additions and 61 deletions

View File

@ -56,13 +56,14 @@ export default function PasteModal() {
setPasteMode(false); setPasteMode(false);
setDisableVideoFocusTrap(false); setDisableVideoFocusTrap(false);
if (rpcDataChannel?.readyState !== "open" || !TextAreaRef.current) return; if (rpcDataChannel?.readyState !== "open" || !TextAreaRef.current) return;
if (!keyboardLayout) return;
if (!chars[keyboardLayout]) return;
const text = TextAreaRef.current.value; const text = TextAreaRef.current.value;
try { try {
for (const char of text) { for (const char of text) {
if (!keyboardLayout) continue;
if (!chars[keyboardLayout]) continue;
const { key, shift, altRight, deadKey, accentKey } = chars[keyboardLayout][char] const { key, shift, altRight, deadKey, accentKey } = chars[keyboardLayout][char]
if (!key) continue; if (!key) continue;

View File

@ -1,42 +1,42 @@
import { chars as chars_cs_CZ, name as name_cs_CZ } from "@/keyboardLayouts/cs_CZ" import { chars as chars_cs_CZ } from "@/keyboardLayouts/cs_CZ"
import { chars as chars_en_UK, name as name_en_UK } from "@/keyboardLayouts/en_UK" import { chars as chars_en_UK } from "@/keyboardLayouts/en_UK"
import { chars as chars_en_US, name as name_en_US } from "@/keyboardLayouts/en_US" import { chars as chars_en_US } from "@/keyboardLayouts/en_US"
import { chars as chars_fr_FR, name as name_fr_FR } from "@/keyboardLayouts/fr_FR" import { chars as chars_fr_FR } from "@/keyboardLayouts/fr_FR"
import { chars as chars_de_DE, name as name_de_DE } from "@/keyboardLayouts/de_DE" import { chars as chars_de_DE } from "@/keyboardLayouts/de_DE"
import { chars as chars_it_IT, name as name_it_IT } from "@/keyboardLayouts/it_IT" import { chars as chars_it_IT } from "@/keyboardLayouts/it_IT"
import { chars as chars_nb_NO, name as name_nb_NO } from "@/keyboardLayouts/nb_NO" import { chars as chars_nb_NO } from "@/keyboardLayouts/nb_NO"
import { chars as chars_es_ES, name as name_es_ES } from "@/keyboardLayouts/es_ES" import { chars as chars_es_ES } from "@/keyboardLayouts/es_ES"
import { chars as chars_sv_SE, name as name_sv_SE } from "@/keyboardLayouts/sv_SE" import { chars as chars_sv_SE } from "@/keyboardLayouts/sv_SE"
import { chars as chars_fr_CH, name as name_fr_CH } from "@/keyboardLayouts/fr_CH" import { chars as chars_fr_CH } from "@/keyboardLayouts/fr_CH"
import { chars as chars_de_CH, name as name_de_CH } from "@/keyboardLayouts/de_CH" import { chars as chars_de_CH } from "@/keyboardLayouts/de_CH"
type KeyInfo = { key: string | number; shift?: boolean, altRight?: boolean } type KeyInfo = { key: string | number; shift?: boolean, altRight?: boolean }
export type KeyCombo = KeyInfo & { deadKey?: boolean, accentKey?: KeyInfo } export type KeyCombo = KeyInfo & { deadKey?: boolean, accentKey?: KeyInfo }
export const layouts: Record<string, string> = { export const layouts = {
cs_CZ: name_cs_CZ, "cs_CZ": "Czech",
en_UK: name_en_UK, "en_UK": "English (UK)",
en_US: name_en_US, "en_US": "English (US)",
fr_FR: name_fr_FR, "fr_FR": "French",
de_DE: name_de_DE, "de_DE": "German",
it_IT: name_it_IT, "it_IT": "Italian",
nb_NO: name_nb_NO, "nb_NO": "Norwegian",
es_ES: name_es_ES, "es_ES": "Spanish",
sv_SE: name_sv_SE, "sv_SE": "Swedish",
fr_CH: name_fr_CH, "fr_CH": "Swiss French",
de_CH: name_de_CH, "de_CH": "Swiss German"
} } as Record<string, string>;
export const chars: Record<string, Record<string, KeyCombo>> = { export const chars = {
cs_CZ: chars_cs_CZ, "cs_CZ": chars_cs_CZ,
en_UK: chars_en_UK, "en_UK": chars_en_UK,
en_US: chars_en_US, "en_US": chars_en_US,
fr_FR: chars_fr_FR, "fr_FR": chars_fr_FR,
de_DE: chars_de_DE, "de_DE": chars_de_DE,
it_IT: chars_it_IT, "it_IT": chars_it_IT,
nb_NO: chars_nb_NO, "nb_NO": chars_nb_NO,
es_ES: chars_es_ES, "es_ES": chars_es_ES,
sv_SE: chars_sv_SE, "sv_SE": chars_sv_SE,
fr_CH: chars_fr_CH, "fr_CH": chars_fr_CH,
de_CH: chars_de_CH, "de_CH": chars_de_CH,
}; } as Record<string, Record <string, KeyCombo>>

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Czech";
const keyTrema = { key: "Backslash" } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "Backslash" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Digit3", shift: true, altRight: true } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "Digit3", shift: true, altRight: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Swiss German";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Minus", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Minus", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Equal" } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "Equal" } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "German";
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Backquote" } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "Backquote" } // accent circonflexe (accent hat), mark ^ placed above the letter
const keyGrave = { key: "Equal", shift: true } // accent grave, mark ` placed above the letter const keyGrave = { key: "Equal", shift: true } // accent grave, mark ` placed above the letter

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "English (UK)";
export const chars = { export const chars = {
A: { key: "KeyA", shift: true }, A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true }, B: { key: "KeyB", shift: true },

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "English (US)";
export const chars = { export const chars = {
A: { key: "KeyA", shift: true }, A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true }, B: { key: "KeyB", shift: true },

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Spanish";
const keyTrema = { key: "Quote", shift: true } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "Quote", shift: true } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Quote" } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Quote" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,8 +1,6 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
import { chars as chars_de_CH } from "./de_CH" import { chars as chars_de_CH } from "./de_CH"
export const name = "Swiss French";
export const chars = { export const chars = {
...chars_de_CH, ...chars_de_CH,
"è": { key: "BracketLeft" }, "è": { key: "BracketLeft" },

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "French";
const keyTrema = { key: "BracketLeft", shift: true } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "BracketLeft", shift: true } // tréma (umlaut), two dots placed above a vowel
const keyHat = { key: "BracketLeft" } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "BracketLeft" } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Italian";
export const chars = { export const chars = {
A: { key: "KeyA", shift: true }, A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true }, B: { key: "KeyB", shift: true },

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Norwegian";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Equal", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,7 +1,5 @@
import { KeyCombo } from "../keyboardLayouts" import { KeyCombo } from "../keyboardLayouts"
export const name = "Swedish";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter