feat(settings): keep dialog open after apply
This commit is contained in:
parent
fcdc7cfc07
commit
f45ee8f272
|
|
@ -276,7 +276,7 @@ function hasChanges(): boolean {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applySettings() {
|
async function persistSettings() {
|
||||||
if (hasBlockingShortcutConflicts.value) return;
|
if (hasBlockingShortcutConflicts.value) return;
|
||||||
settingsStore.updateEditorSettings({
|
settingsStore.updateEditorSettings({
|
||||||
fontFamily: editFontFamily.value,
|
fontFamily: editFontFamily.value,
|
||||||
|
|
@ -299,6 +299,14 @@ async function applySettings() {
|
||||||
await settingsStore.updateDesktopSettings({
|
await settingsStore.updateDesktopSettings({
|
||||||
show_tray_icon: editShowTrayIcon.value,
|
show_tray_icon: editShowTrayIcon.value,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applySettings() {
|
||||||
|
await persistSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applySettingsAndClose() {
|
||||||
|
await persistSettings();
|
||||||
emit("update:open", false);
|
emit("update:open", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1796,6 +1804,9 @@ watch(
|
||||||
<Button :disabled="!hasChanges() || hasBlockingShortcutConflicts" @click="applySettings">
|
<Button :disabled="!hasChanges() || hasBlockingShortcutConflicts" @click="applySettings">
|
||||||
{{ t("settings.apply") }}
|
{{ t("settings.apply") }}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button :disabled="!hasChanges() || hasBlockingShortcutConflicts" @click="applySettingsAndClose">
|
||||||
|
{{ t("settings.applyAndClose") }}
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|
||||||
<DialogFooter
|
<DialogFooter
|
||||||
|
|
|
||||||
|
|
@ -1464,6 +1464,7 @@ export default {
|
||||||
syncSecretsSkipped: "Encrypted secrets were present but were not restored.",
|
syncSecretsSkipped: "Encrypted secrets were present but were not restored.",
|
||||||
syncDownloadConfirm: "Download and apply the remote DBX snapshot? Local metadata and saved SQL will be replaced.",
|
syncDownloadConfirm: "Download and apply the remote DBX snapshot? Local metadata and saved SQL will be replaced.",
|
||||||
apply: "Apply",
|
apply: "Apply",
|
||||||
|
applyAndClose: "Apply and Close",
|
||||||
reset: "Reset",
|
reset: "Reset",
|
||||||
resetDefaults: "Reset Defaults",
|
resetDefaults: "Reset Defaults",
|
||||||
save: "Save",
|
save: "Save",
|
||||||
|
|
|
||||||
|
|
@ -1359,6 +1359,7 @@ export default {
|
||||||
syncDownloadConfirm:
|
syncDownloadConfirm:
|
||||||
"¿Descargar y aplicar la instantánea remota de DBX? Se reemplazarán metadatos locales y SQL guardado.",
|
"¿Descargar y aplicar la instantánea remota de DBX? Se reemplazarán metadatos locales y SQL guardado.",
|
||||||
apply: "Aplicar",
|
apply: "Aplicar",
|
||||||
|
applyAndClose: "Aplicar y cerrar",
|
||||||
reset: "Restablecer",
|
reset: "Restablecer",
|
||||||
resetDefaults: "Restablecer valores por defecto",
|
resetDefaults: "Restablecer valores por defecto",
|
||||||
executeMode: "Modo de ejecución (Cmd+Enter)",
|
executeMode: "Modo de ejecución (Cmd+Enter)",
|
||||||
|
|
|
||||||
|
|
@ -1430,6 +1430,7 @@ export default {
|
||||||
syncSecretsSkipped: "远端包含加密敏感信息,但本次未恢复。",
|
syncSecretsSkipped: "远端包含加密敏感信息,但本次未恢复。",
|
||||||
syncDownloadConfirm: "要下载并应用远端 DBX 快照吗?本地元信息和保存的 SQL 会被替换。",
|
syncDownloadConfirm: "要下载并应用远端 DBX 快照吗?本地元信息和保存的 SQL 会被替换。",
|
||||||
apply: "应用",
|
apply: "应用",
|
||||||
|
applyAndClose: "应用并关闭",
|
||||||
reset: "重置",
|
reset: "重置",
|
||||||
resetDefaults: "恢复默认",
|
resetDefaults: "恢复默认",
|
||||||
save: "保存",
|
save: "保存",
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,14 @@ test("shortcut conflicts only block applying changed shortcut settings", () => {
|
||||||
assert.match(source, /:disabled="!hasChanges\(\) \|\| hasBlockingShortcutConflicts"/);
|
assert.match(source, /:disabled="!hasChanges\(\) \|\| hasBlockingShortcutConflicts"/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("settings dialog exposes separate apply and apply-and-close actions", () => {
|
||||||
|
assert.match(source, /async function persistSettings\(\)/);
|
||||||
|
assert.match(source, /async function applySettings\(\)/);
|
||||||
|
assert.match(source, /async function applySettingsAndClose\(\)/);
|
||||||
|
assert.match(source, /await persistSettings\(\);[\s\S]*emit\("update:open", false\)/);
|
||||||
|
assert.match(source, /t\("settings\.applyAndClose"\)/);
|
||||||
|
});
|
||||||
|
|
||||||
test("settings dialog exposes sidebar activation in navigation settings", () => {
|
test("settings dialog exposes sidebar activation in navigation settings", () => {
|
||||||
assert.match(source, /value: "navigation"/);
|
assert.match(source, /value: "navigation"/);
|
||||||
assert.match(source, /activeSettingsTab === ['"]navigation['"]/);
|
assert.match(source, /activeSettingsTab === ['"]navigation['"]/);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue