update obsidian shape deployment

This commit is contained in:
Jeff Emmett 2025-11-12 16:23:08 -08:00
parent 03c834779b
commit 783a8702f9
4 changed files with 21 additions and 40 deletions

View File

@ -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

View File

@ -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(() => {

View File

@ -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

View File

@ -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