Properly save when manually choosing layout

This commit is contained in:
David Martin 2020-10-26 19:33:41 -05:00
parent 575810f660
commit db2de0c7b7
3 changed files with 11 additions and 3 deletions

View file

@ -1510,7 +1510,7 @@ if (Object.keys(layouts).length > 0) {
id: "changeLayout" + capitalizeFirstLetter(layout),
display: layout.replace(/_/g, " "),
exec: () => {
changeLayout(layout);
changeSavedLayout(layout);
restartTest();
saveConfigToCookie();
},

View file

@ -229,7 +229,7 @@ settingsGroups.capsLockBackspace = new SettingsGroup(
"capsLockBackspace",
setCapsLockBackspace
);
settingsGroups.layout = new SettingsGroup("layout", changeLayout);
settingsGroups.layout = new SettingsGroup("layout", changeSavedLayout);
settingsGroups.language = new SettingsGroup("language", changeLanguage);
settingsGroups.fontSize = new SettingsGroup("fontSize", changeFontSize);
settingsGroups.pageWidth = new SettingsGroup("pageWidth", setPageWidth);

View file

@ -167,7 +167,7 @@ function applyConfig(configObj) {
changeWordCount(configObj.words, true);
changeLanguage(configObj.language, true);
setCapsLockBackspace(configObj.capsLockBackspace, true);
changeLayout(configObj.savedLayout, true);
changeSavedLayout(configObj.savedLayout, true);
changeFontSize(configObj.fontSize, true);
setFreedomMode(configObj.freedomMode, true);
setCaretStyle(configObj.caretStyle, true);
@ -1181,6 +1181,14 @@ function changeLayout(layout, nosave) {
if (!nosave) saveConfigToCookie();
}
function changeSavedLayout(layout, nosave) {
if (layout == null || layout == undefined) {
layout = "qwerty";
}
config.savedLayout = layout;
changeLayout(layout, nosave);
}
function changeKeymapMode(mode, nosave) {
if (mode == null || mode == undefined) {
mode = "off";