fix style pack export guard and switch-style sync
This commit is contained in:
1 parent
a4c4cc224b
commit
ae2c7e4e74
2 files changed
+16
No files matched your search
@@ -1438,6 +1438,16 @@ fn switch_to_previous_style(inner: &Arc<Inner>) {
|
||||
"[coord] switch style hotkey changed active style pack to {}",
|
||||
prefs.active_style_pack_id
|
||||
);
|
||||
if let Some(app) = inner.app.lock().clone() {
|
||||
let _ = app.emit("prefs:changed", &prefs);
|
||||
let _ = app.emit_to("main", "prefs:changed", &prefs);
|
||||
let app_for_main = app.clone();
|
||||
let _ = app.run_on_main_thread(move || {
|
||||
if let Err(err) = crate::refresh_tray_microphone_menu(&app_for_main) {
|
||||
log::warn!("[tray] refresh style menu after switch style hotkey failed: {err}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ export function Style() {
|
||||
importFailed: (message: string) => (isEnglish ? `Failed to import ZIP: ${message}` : `导入 ZIP 失败:${message}`),
|
||||
exportSuccess: (path: string) => (isEnglish ? `Exported to ${path}` : `已导出到 ${path}`),
|
||||
exportFailed: (message: string) => (isEnglish ? `Failed to export ZIP: ${message}` : `导出 ZIP 失败:${message}`),
|
||||
exportDirtyFirst: isEnglish ? 'Save this pack before exporting ZIP.' : '请先保存当前风格包,再导出 ZIP。',
|
||||
resetBuiltin: isEnglish ? 'Reset' : '重置',
|
||||
resetSuccess: (name: string) => (isEnglish ? `Reset "${name}".` : `已重置“${name}”`),
|
||||
resetFailed: (message: string) => (isEnglish ? `Failed to reset pack: ${message}` : `重置风格包失败:${message}`),
|
||||
@@ -468,6 +469,11 @@ export function Style() {
|
||||
|
||||
const handleExportZip = async (pack = selectedPack) => {
|
||||
if (!pack) return;
|
||||
if (editorOpen && dirty && selectedPack && pack.id === selectedPack.id) {
|
||||
setError(copy.exportDirtyFirst);
|
||||
setNotice(null);
|
||||
return;
|
||||
}
|
||||
setBusy('exporting');
|
||||
try {
|
||||
const defaultName = `${sanitizeZipFileName(pack.name)}.zip`;
|
||||
|
||||
Reference in new issue
Block a user