feat: Add 'Restore Default Themes' command for vaults missing theme structure

- New restore_default_themes() Rust fn: seeds both _themes/ and theme/ dirs
- Per-file idempotent: never overwrites existing files with content
- Fixed ensure_vault_themes() to include minimal.md (was missing)
- New 'Restore Default Themes' command in Cmd+K Appearance group
- 3 new Rust tests + 4 new frontend tests
- 1676 frontend tests passed
This commit is contained in:
lucaronin
2026-03-05 11:18:53 +01:00
parent e817d088eb
commit d5849593ea
7 changed files with 157 additions and 3 deletions

View File

@@ -500,6 +500,12 @@ fn ensure_vault_themes(vault_path: String) -> Result<(), String> {
theme::ensure_vault_themes(&vault_path)
}
#[tauri::command]
fn restore_default_themes(vault_path: String) -> Result<String, String> {
let vault_path = expand_tilde(&vault_path);
theme::restore_default_themes(&vault_path)
}
fn log_startup_result(label: &str, result: Result<usize, String>) {
match result {
Ok(n) if n > 0 => log::info!("{}: {} files", label, n),
@@ -699,7 +705,8 @@ pub fn run() {
set_active_theme,
create_theme,
create_vault_theme,
ensure_vault_themes
ensure_vault_themes,
restore_default_themes
])
.build(tauri::generate_context!())
.expect("error while building tauri application")