Problem: Every time you click on a burg/marker, it had to scan through
all 13,496 vault files looking for a matching fmg-id. This was extremely
slow and made the feature unusable for large vaults.
Solution: Implement a smart index that maps fmg-id to file paths.
How it works:
- Index stored in memory (fmgIdIndex object)
- Persisted to localStorage (survives page reloads)
- Loaded on init, saved on changes
- When looking up by fmg-id:
1. Check index first (instant!)
2. If found, verify file still exists and ID matches
3. If not in index, search vault and add to index
- Automatically updates when notes are created/saved through FMG
- Handles stale entries (file deleted/modified)
Performance improvement:
- Before: O(n) - scan all 13k files (very slow)
- After: O(1) - instant lookup from index
- First click on burg: May need to search (builds index)
- Second click on same burg: Instant! Opens note directly
This makes the Obsidian integration actually usable. Create a note once
for a burg, and every time you click that burg again, it opens instantly.
The previous implementation read ALL file contents to get frontmatter
when browsing notes, which caused massive slowdown for large vaults
(13k+ files = 13k+ HTTP requests).
Changes:
- Add listAllNotePaths() function that only gets file paths (fast)
- Build folder tree from paths only, no content reading
- Lazy load file content only when user clicks on a file
- Change message from "Loading all notes" to "Loading file list"
- Add logging to show file count being displayed
Performance improvement:
- Before: O(n) HTTP requests where n = number of files
- After: O(1) - just the recursive directory scan
- File content loaded on-demand (1 request per clicked file)
This makes the folder tree instant even for vaults with 10k+ files.
- Add debug logging to getVaultFiles() to show file counts
- Add logging to listAllNotes() to show processing details
- Add logging to buildFolderTree() to trace folder creation
- Filter .md files in getVaultFiles() for better performance
- Log sample file paths to help diagnose API response format
This will help identify why nested folders aren't appearing in the
folder tree browser.
Replaced flat list with hierarchical folder tree structure for better
navigation when browsing vault notes.
**Features:**
- Collapsible folders with ▼/▶ toggle arrows
- Proper indentation showing folder hierarchy
- 📁 folder and 📄 file icons
- Click folder name to expand/collapse
- Click file to select it
- Handles root-level files and nested folders
- Hover highlights for files
**Functions added:**
- buildFolderTree(): Converts flat note list to tree structure
- renderFolderTree(): Recursively renders folders with nesting
- renderFiles(): Renders files at current folder level
Perfect for vaults organized like:
```
State1/
Province1/
City1.md
City2.md
Province2/
City3.md
State2/
Province3/
City4.md
```
Much easier to navigate than a flat list of 100+ notes!
When a user selects or creates a note for a burg/marker, the system now
automatically links them together by adding/updating the note's frontmatter.
**How it works:**
1. **When saving a note**:
- Adds `fmg-id: burg123` to frontmatter
- Updates `x:` and `y:` coordinates
- Preserves existing frontmatter fields
2. **When creating a new note**:
- Template includes fmg-id from the start
- Uses the proper elementId (e.g., "burg123")
3. **Next time you edit**:
- System finds note instantly by fmg-id
- No need to search by coordinates again
- Permanent two-way link established
**Changes:**
- obsidian-notes-editor.js:
- Pass elementId and coordinates to showMarkdownEditor()
- updateFrontmatterWithFmgData() injects fmg-id on save
- Automatically updates coordinates to keep in sync
- obsidian-bridge.js:
- generateNoteTemplate() accepts elementId parameter
- Uses elementId for fmg-id instead of element.id
Users no longer need to manually match notes - once linked, the
association is permanent in the note's frontmatter.
Enhanced the Obsidian note finding system with:
**ObsidianBridge:**
- searchNotes(query): Search vault by filename
- listAllNotes(): Browse all notes in vault
**Obsidian Notes Editor:**
- Text search box with auto-populated state/province
- "Browse All Notes" button to see full vault
- Display burg's state and province in dialog
- Pre-fill search with state name for easier finding
- Enter key triggers search
- Click any result to load that note
**getElementData enhancement:**
- Extract and include state/province names for burgs
- Extract state/province from cell data for markers
Now users can:
1. See which state/province the burg belongs to
2. Search by state name (pre-filled)
3. Search by any text in filename
4. Browse all notes manually
5. Click to select matching note
This addresses the user's organization structure where notes are
stored in State/Province folders matching the map structure.
Add comprehensive Obsidian integration as intermediate step toward
PostgreSQL migration, enabling modern Markdown-based note editing:
**Features:**
- Obsidian Local REST API integration for vault access
- Coordinate-based note matching (searches vault YAML frontmatter)
- Shows top 5-8 closest matches when clicking burgs/markers
- Modern Markdown editor with live preview
- [[Wikilink]] support for connecting notes
- "Open in Obsidian" button to jump to native app
- Configuration UI for API setup and testing
**Technical Implementation:**
- modules/io/obsidian-bridge.js - Core API integration layer
- modules/ui/obsidian-notes-editor.js - Markdown editor UI
- modules/ui/obsidian-config.js - Configuration panel
- OBSIDIAN_INTEGRATION.md - Complete setup/usage guide
**Coordinate Matching:**
- Parses YAML frontmatter for x/y coordinates
- Calculates distance to clicked element
- Supports nested (coordinates.x) and flat (x:) formats
- Handles missing FMG IDs (common with PostgreSQL imports)
**User Workflow:**
1. Configure Obsidian REST API connection
2. Click burg/marker in FMG
3. System finds matching notes by coordinates
4. Select note or create new one
5. Edit in modern Markdown editor
6. Save syncs to Obsidian vault instantly
This replaces the "Win95-style TinyMCE" editor with a clean,
modern Markdown experience while maintaining compatibility with
the eventual PostgreSQL backend migration. Users can edit notes
in either FMG or Obsidian - both stay in sync via file system.
Version: 1.108.13