fix: unable to enable some layouts due to an incorrect schema

closes #5948
This commit is contained in:
Miodec 2024-10-16 14:31:06 +02:00
parent 9f7aeac5af
commit 5e35892e47
3 changed files with 9 additions and 6 deletions

View file

@ -439,8 +439,8 @@ describe("Config", () => {
it("setKeymapLayout", () => {
expect(Config.setKeymapLayout("overrideSync")).toBe(true);
expect(Config.setKeymapLayout("override_sync")).toBe(true);
expect(Config.setKeymapLayout("override sync")).toBe(true);
expect(Config.setKeymapLayout("override-sync!")).toBe(true);
expect(Config.setKeymapLayout("override sync")).toBe(false);
expect(Config.setKeymapLayout("override-sync!")).toBe(false);
expect(Config.setKeymapLayout(stringOfLength(50))).toBe(true);
expect(Config.setKeymapLayout(stringOfLength(51))).toBe(false);
@ -451,7 +451,7 @@ describe("Config", () => {
expect(Config.setLayout(stringOfLength(50))).toBe(true);
expect(Config.setLayout("semi mak")).toBe(false);
expect(Config.setLayout("semi-mak")).toBe(false);
expect(Config.setLayout("semi-mak")).toBe(true);
expect(Config.setLayout(stringOfLength(51))).toBe(false);
});
it("setFontSize", () => {

View file

@ -1419,7 +1419,7 @@
"row5": [" "]
}
},
"3l ": {
"3l": {
"keymapShowTopRow": false,
"type": "ansi",
"keys": {

View file

@ -265,10 +265,13 @@ export type ThemeName = z.infer<typeof ThemeNameSchema>;
export const KeymapLayoutSchema = z
.string()
.max(50)
.regex(/[\w\-_]+/);
.regex(/^[a-zA-Z0-9\-_]+$/gi);
export type KeymapLayout = z.infer<typeof KeymapLayoutSchema>;
export const LayoutSchema = token().max(50);
export const LayoutSchema = z
.string()
.max(50)
.regex(/^[a-zA-Z0-9\-_]+$/gi);
export type Layout = z.infer<typeof LayoutSchema>;
export const FontSizeSchema = z.number().positive();