diff --git a/packages/editor/App.tsx b/packages/editor/App.tsx index 8623408..fb58e2c 100644 --- a/packages/editor/App.tsx +++ b/packages/editor/App.tsx @@ -14,7 +14,7 @@ import { Settings } from '@plannotator/ui/components/Settings'; import { useSharing } from '@plannotator/ui/hooks/useSharing'; import { storage } from '@plannotator/ui/utils/storage'; import { UpdateBanner } from '@plannotator/ui/components/UpdateBanner'; -import { getObsidianSettings } from '@plannotator/ui/utils/obsidian'; +import { getObsidianSettings, getEffectiveVaultPath, CUSTOM_PATH_SENTINEL } from '@plannotator/ui/utils/obsidian'; import { getBearSettings } from '@plannotator/ui/utils/bear'; import { getAgentSwitchSettings, getEffectiveAgentName } from '@plannotator/ui/utils/agentSwitch'; import { getPlanSaveSettings } from '@plannotator/ui/utils/planSave'; @@ -494,9 +494,10 @@ const App: React.FC = () => { ...(planSaveSettings.customPath && { customPath: planSaveSettings.customPath }), }; - if (obsidianSettings.enabled && obsidianSettings.vaultPath) { + const effectiveVaultPath = getEffectiveVaultPath(obsidianSettings); + if (obsidianSettings.enabled && effectiveVaultPath) { body.obsidian = { - vaultPath: obsidianSettings.vaultPath, + vaultPath: effectiveVaultPath, folder: obsidianSettings.folder || 'plannotator', plan: markdown, }; diff --git a/packages/ui/components/Settings.tsx b/packages/ui/components/Settings.tsx index b697766..781be1c 100644 --- a/packages/ui/components/Settings.tsx +++ b/packages/ui/components/Settings.tsx @@ -5,6 +5,7 @@ import { getIdentity, regenerateIdentity } from '../utils/identity'; import { getObsidianSettings, saveObsidianSettings, + CUSTOM_PATH_SENTINEL, type ObsidianSettings, } from '../utils/obsidian'; import { @@ -358,17 +359,29 @@ export const Settings: React.FC = ({ taterMode, onTaterModeChange Detecting... ) : detectedVaults.length > 0 ? ( - + <> + + {obsidian.vaultPath === CUSTOM_PATH_SENTINEL && ( + handleObsidianChange({ customPath: e.target.value })} + placeholder="/path/to/folder" + className="w-full mt-2 px-3 py-2 bg-muted rounded-lg text-xs font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary/50" + /> + )} + ) : ( = ({ taterMode, onTaterModeChange {/* Save path preview */}
- Plans saved to: {obsidian.vaultPath || '...'}/{obsidian.folder || 'plannotator'}/ + Plans saved to: {obsidian.vaultPath === CUSTOM_PATH_SENTINEL + ? (obsidian.customPath || '...') + : (obsidian.vaultPath || '...')}/{obsidian.folder || 'plannotator'}/
{/* Frontmatter Preview */} diff --git a/packages/ui/utils/obsidian.ts b/packages/ui/utils/obsidian.ts index 9163461..b871578 100644 --- a/packages/ui/utils/obsidian.ts +++ b/packages/ui/utils/obsidian.ts @@ -12,6 +12,10 @@ import { storage } from './storage'; const STORAGE_KEY_ENABLED = 'plannotator-obsidian-enabled'; const STORAGE_KEY_VAULT = 'plannotator-obsidian-vault'; const STORAGE_KEY_FOLDER = 'plannotator-obsidian-folder'; +const STORAGE_KEY_CUSTOM_PATH = 'plannotator-obsidian-custom-path'; + +// Sentinel value for custom path selection +export const CUSTOM_PATH_SENTINEL = '__custom__'; // Default folder name in the vault const DEFAULT_FOLDER = 'plannotator'; @@ -21,8 +25,9 @@ const DEFAULT_FOLDER = 'plannotator'; */ export interface ObsidianSettings { enabled: boolean; - vaultPath: string; + vaultPath: string; // Selected vault path OR '__custom__' sentinel folder: string; + customPath?: string; // User-entered path when vaultPath === '__custom__' } /** @@ -33,6 +38,7 @@ export function getObsidianSettings(): ObsidianSettings { enabled: storage.getItem(STORAGE_KEY_ENABLED) === 'true', vaultPath: storage.getItem(STORAGE_KEY_VAULT) || '', folder: storage.getItem(STORAGE_KEY_FOLDER) || DEFAULT_FOLDER, + customPath: storage.getItem(STORAGE_KEY_CUSTOM_PATH) || undefined, }; } @@ -43,6 +49,17 @@ export function saveObsidianSettings(settings: ObsidianSettings): void { storage.setItem(STORAGE_KEY_ENABLED, String(settings.enabled)); storage.setItem(STORAGE_KEY_VAULT, settings.vaultPath); storage.setItem(STORAGE_KEY_FOLDER, settings.folder); + storage.setItem(STORAGE_KEY_CUSTOM_PATH, settings.customPath || ''); +} + +/** + * Get the effective vault path, resolving custom path if selected + */ +export function getEffectiveVaultPath(settings: ObsidianSettings): string { + if (settings.vaultPath === CUSTOM_PATH_SENTINEL) { + return settings.customPath || ''; + } + return settings.vaultPath; } /** @@ -50,7 +67,8 @@ export function saveObsidianSettings(settings: ObsidianSettings): void { */ export function isObsidianConfigured(): boolean { const settings = getObsidianSettings(); - return settings.enabled && settings.vaultPath.trim().length > 0; + const effectivePath = getEffectiveVaultPath(settings); + return settings.enabled && effectivePath.trim().length > 0; } /** -- knotmirror 0.0.1 From 12385beef567cc5017b5dc172e5b37fc4a78fbec Mon Sep 17 00:00:00 2001 From: Michael Ramos Date: Wed, 14 Jan 2026 14:28:29 -0800 Subject: [PATCH 2/2] fix: use correct placeholder for custom vault path Co-Authored-By: Claude Opus 4.5 --- packages/ui/components/Settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/components/Settings.tsx b/packages/ui/components/Settings.tsx index 781be1c..9ab35ef 100644 --- a/packages/ui/components/Settings.tsx +++ b/packages/ui/components/Settings.tsx @@ -377,7 +377,7 @@ export const Settings: React.FC = ({ taterMode, onTaterModeChange type="text" value={obsidian.customPath || ''} onChange={(e) => handleObsidianChange({ customPath: e.target.value })} - placeholder="/path/to/folder" + placeholder="/path/to/vault" className="w-full mt-2 px-3 py-2 bg-muted rounded-lg text-xs font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary/50" /> )}