feat(export): remember last export directory and support preferred directory
This commit is contained in:
1 parent
2e98a5bb9f
commit
02bc0cf47e
28 files changed
+497
-83
No files matched your search
@@ -900,6 +900,7 @@ const editSidebarShowTooltips = ref(settingsStore.editorSettings.sidebarShowTool
|
||||
const editSidebarIndent = ref(settingsStore.editorSettings.sidebarIndent);
|
||||
const editSidebarFontSize = ref(settingsStore.editorSettings.sidebarFontSize);
|
||||
const editExportBatchSize = ref(settingsStore.editorSettings.exportBatchSize);
|
||||
const editPreferredExportPath = ref(settingsStore.editorSettings.preferredExportPath);
|
||||
const editCsvQuoteMode = ref<CsvQuoteMode>(settingsStore.editorSettings.csvQuoteMode);
|
||||
const editCsvNullMode = ref<CsvNullMode>(settingsStore.editorSettings.csvNullMode);
|
||||
const editGlobalDateTimeDisplayFormat = ref(settingsStore.editorSettings.globalDateTimeDisplayFormat);
|
||||
@@ -1177,6 +1178,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
|
||||
redisKeyTemplates: normalizeRedisKeyTemplates(editRedisKeyTemplates.value),
|
||||
redisDatabaseDisplayLimit: editRedisDatabaseDisplayLimit.value,
|
||||
exportBatchSize: editExportBatchSize.value,
|
||||
preferredExportPath: editPreferredExportPath.value,
|
||||
csvQuoteMode: editCsvQuoteMode.value,
|
||||
csvNullMode: editCsvNullMode.value,
|
||||
globalDateTimeDisplayFormat: editGlobalDateTimeDisplayFormat.value,
|
||||
@@ -1853,6 +1855,7 @@ function syncEditorSettingsDraftFromStore() {
|
||||
editSidebarIndent.value = settingsStore.editorSettings.sidebarIndent;
|
||||
editSidebarFontSize.value = settingsStore.editorSettings.sidebarFontSize;
|
||||
editExportBatchSize.value = settingsStore.editorSettings.exportBatchSize;
|
||||
editPreferredExportPath.value = settingsStore.editorSettings.preferredExportPath;
|
||||
editCsvQuoteMode.value = settingsStore.editorSettings.csvQuoteMode;
|
||||
editCsvNullMode.value = settingsStore.editorSettings.csvNullMode;
|
||||
editGlobalDateTimeDisplayFormat.value = settingsStore.editorSettings.globalDateTimeDisplayFormat;
|
||||
@@ -2003,6 +2006,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
|
||||
redisKeyTemplates: editRedisKeyTemplates,
|
||||
redisDatabaseDisplayLimit: editRedisDatabaseDisplayLimit,
|
||||
exportBatchSize: editExportBatchSize,
|
||||
preferredExportPath: editPreferredExportPath,
|
||||
csvQuoteMode: editCsvQuoteMode,
|
||||
csvNullMode: editCsvNullMode,
|
||||
exportRowLimitEnabled: editExportRowLimitEnabled,
|
||||
@@ -2332,6 +2336,7 @@ async function persistSettings() {
|
||||
// result back into the input so an out-of-range draft doesn't keep
|
||||
// reporting unsaved changes after a successful apply.
|
||||
editRedisDatabaseDisplayLimit.value = settingsStore.editorSettings.redisDatabaseDisplayLimit;
|
||||
editPreferredExportPath.value = settingsStore.editorSettings.preferredExportPath;
|
||||
// 同理:落盘口径可能改写键位(跨平台默认键、保留键回退),草稿要跟着回到
|
||||
// 落盘值,避免面板卡在“未保存”无法应用(#9881)。
|
||||
editShortcuts.value = normalizeShortcutSettings(settingsStore.editorSettings.shortcuts);
|
||||
@@ -2554,6 +2559,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
|
||||
editRedisKeyTemplates.value = normalizeRedisKeyTemplates(DEFAULT_EDITOR_SETTINGS.redisKeyTemplates).join("\n");
|
||||
editRedisDatabaseDisplayLimit.value = DEFAULT_EDITOR_SETTINGS.redisDatabaseDisplayLimit;
|
||||
editExportBatchSize.value = DEFAULT_EDITOR_SETTINGS.exportBatchSize;
|
||||
editPreferredExportPath.value = DEFAULT_EDITOR_SETTINGS.preferredExportPath;
|
||||
editCsvQuoteMode.value = DEFAULT_EDITOR_SETTINGS.csvQuoteMode;
|
||||
editCsvNullMode.value = DEFAULT_EDITOR_SETTINGS.csvNullMode;
|
||||
editGlobalDateTimeDisplayFormat.value = DEFAULT_EDITOR_SETTINGS.globalDateTimeDisplayFormat;
|
||||
@@ -2708,6 +2714,7 @@ function resetAllDefaults() {
|
||||
editRedisKeyTemplates.value = normalizeRedisKeyTemplates(DEFAULT_EDITOR_SETTINGS.redisKeyTemplates).join("\n");
|
||||
editRedisDatabaseDisplayLimit.value = DEFAULT_EDITOR_SETTINGS.redisDatabaseDisplayLimit;
|
||||
editExportBatchSize.value = DEFAULT_EDITOR_SETTINGS.exportBatchSize;
|
||||
editPreferredExportPath.value = DEFAULT_EDITOR_SETTINGS.preferredExportPath;
|
||||
editCsvQuoteMode.value = DEFAULT_EDITOR_SETTINGS.csvQuoteMode;
|
||||
editCsvNullMode.value = DEFAULT_EDITOR_SETTINGS.csvNullMode;
|
||||
editGlobalDateTimeDisplayFormat.value = DEFAULT_EDITOR_SETTINGS.globalDateTimeDisplayFormat;
|
||||
@@ -3188,6 +3195,18 @@ async function commitCustomSkillRoot() {
|
||||
if ((settingsStore.desktopSettings.custom_ai_skill_root ?? "") === trimmed) return;
|
||||
await settingsStore.updateDesktopSettings({ custom_ai_skill_root: trimmed || null });
|
||||
}
|
||||
async function pickPreferredExportPath() {
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({
|
||||
directory: true,
|
||||
multiple: false,
|
||||
title: t("settings.preferredExportPathChoose"),
|
||||
defaultPath: editPreferredExportPath.value.trim() || undefined,
|
||||
});
|
||||
if (typeof selected !== "string" || !selected.trim()) return;
|
||||
editPreferredExportPath.value = selected.trim();
|
||||
}
|
||||
|
||||
async function pickCustomSkillRoot() {
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({ directory: true, multiple: false, title: t("settings.aiSkillRoot") });
|
||||
@@ -9037,6 +9056,19 @@ onUnmounted(() => {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div data-settings-search-id="data-export-preferred-path" :class="['space-y-2', settingsSearchTargetClass('data-export-preferred-path')]">
|
||||
<Label for="export-preferred-path">{{ t("settings.preferredExportPath") }}</Label>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input id="export-preferred-path" v-model="editPreferredExportPath" :placeholder="t('settings.preferredExportPathPlaceholder')" class="h-9 flex-1 font-mono text-xs" />
|
||||
<Button v-if="!isWeb" type="button" variant="outline" size="sm" class="h-9 shrink-0 px-2.5" :title="t('settings.preferredExportPathChoose')" :aria-label="t('settings.preferredExportPathChoose')" @click="pickPreferredExportPath">
|
||||
<FolderOpen class="h-4 w-4" />
|
||||
</Button>
|
||||
<Button v-if="editPreferredExportPath" type="button" variant="ghost" size="sm" class="h-9 shrink-0 px-2" :title="t('settings.preferredExportPathClear')" :aria-label="t('settings.preferredExportPathClear')" @click="editPreferredExportPath = ''">
|
||||
<X class="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<p class="text-xs text-muted-foreground">{{ t("settings.preferredExportPathDescription") }}</p>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<Label>{{ t("settings.exportBatchSize") }}</Label>
|
||||
<div class="flex items-center gap-3">
|
||||
|
||||
Reference in new issue
Block a user