diff --git a/src/automerge/CloudflareAdapter.ts b/src/automerge/CloudflareAdapter.ts index 08c6ac4..bfa5275 100644 --- a/src/automerge/CloudflareAdapter.ts +++ b/src/automerge/CloudflareAdapter.ts @@ -48,7 +48,15 @@ export class CloudflareAdapter { // Focus on the store data which is what actually changes const storeData = doc.store || {} const storeKeys = Object.keys(storeData).sort() - const storeString = JSON.stringify(storeData, storeKeys) + + // CRITICAL FIX: JSON.stringify's second parameter when it's an array is a replacer + // that only includes those properties. We need to stringify the entire store object. + // To ensure stable ordering, create a new object with sorted keys + const sortedStore: any = {} + for (const key of storeKeys) { + sortedStore[key] = storeData[key] + } + const storeString = JSON.stringify(sortedStore) // Simple hash function (you could use a more sophisticated one if needed) let hash = 0 diff --git a/src/ui/CustomToolbar.tsx b/src/ui/CustomToolbar.tsx index 55c5bca..bbf44cb 100644 --- a/src/ui/CustomToolbar.tsx +++ b/src/ui/CustomToolbar.tsx @@ -59,43 +59,8 @@ export function CustomToolbar() { } }, [showProfilePopup]) - // Keyboard shortcut for Alt+O to open Obsidian vault browser - useEffect(() => { - const handleKeyDown = (event: KeyboardEvent) => { - // Check for Alt+O (keyCode 79 for 'O') - if (event.altKey && event.key === 'o') { - event.preventDefault() - - // If vault browser is already open, close it - if (showVaultBrowser) { - console.log('🔧 Alt+O pressed, vault browser already open, closing it') - setShowVaultBrowser(false) - return - } - - // Check if user already has a vault selected - if (session.obsidianVaultPath && session.obsidianVaultPath !== 'folder-selected') { - console.log('🔧 Alt+O pressed, vault already selected, opening search interface') - setVaultBrowserMode('keyboard') - setShowVaultBrowser(true) - } else if (session.obsidianVaultPath === 'folder-selected' && session.obsidianVaultName) { - console.log('🔧 Alt+O pressed, folder-selected vault exists, opening search interface') - setVaultBrowserMode('keyboard') - setShowVaultBrowser(true) - } else { - console.log('🔧 Alt+O pressed, no vault selected, opening vault selection') - setVaultBrowserMode('keyboard') - setShowVaultBrowser(true) - } - } - } - - document.addEventListener('keydown', handleKeyDown) - - return () => { - document.removeEventListener('keydown', handleKeyDown) - } - }, [session.obsidianVaultPath, session.obsidianVaultName, showVaultBrowser]) + // Alt+O is now handled by the tool system via overrides.tsx + // It selects the ObsidianNote tool, which waits for canvas click before deploying // Listen for open-fathom-meetings event - now creates a shape instead of modal useEffect(() => { diff --git a/src/ui/overrides.tsx b/src/ui/overrides.tsx index a2083ba..185fc2f 100644 --- a/src/ui/overrides.tsx +++ b/src/ui/overrides.tsx @@ -478,7 +478,7 @@ export const overrides: TLUiOverrides = { openObsidianBrowser: { id: "open-obsidian-browser", label: "Open Obsidian Browser", - kbd: "alt+o", + // Removed kbd: "alt+o" - Alt+O now selects the ObsidianNote tool instead readonlyOk: true, onSelect: () => { // Trigger the Obsidian browser to open diff --git a/worker/AutomergeDurableObject.ts b/worker/AutomergeDurableObject.ts index 2ccc47a..ab33126 100644 --- a/worker/AutomergeDurableObject.ts +++ b/worker/AutomergeDurableObject.ts @@ -427,7 +427,15 @@ export class AutomergeDurableObject { // Focus on the store data which is what actually changes const storeData = doc.store || {} const storeKeys = Object.keys(storeData).sort() - const storeString = JSON.stringify(storeData, storeKeys) + + // CRITICAL FIX: JSON.stringify's second parameter when it's an array is a replacer + // that only includes those properties. We need to stringify the entire store object. + // To ensure stable ordering, create a new object with sorted keys + const sortedStore: any = {} + for (const key of storeKeys) { + sortedStore[key] = storeData[key] + } + const storeString = JSON.stringify(sortedStore) // Simple hash function (you could use a more sophisticated one if needed) let hash = 0