update obsidian shape deployment
This commit is contained in:
parent
ab1d0344a5
commit
4d7b05efa2
|
|
@ -48,7 +48,15 @@ export class CloudflareAdapter {
|
||||||
// Focus on the store data which is what actually changes
|
// Focus on the store data which is what actually changes
|
||||||
const storeData = doc.store || {}
|
const storeData = doc.store || {}
|
||||||
const storeKeys = Object.keys(storeData).sort()
|
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)
|
// Simple hash function (you could use a more sophisticated one if needed)
|
||||||
let hash = 0
|
let hash = 0
|
||||||
|
|
|
||||||
|
|
@ -59,43 +59,8 @@ export function CustomToolbar() {
|
||||||
}
|
}
|
||||||
}, [showProfilePopup])
|
}, [showProfilePopup])
|
||||||
|
|
||||||
// Keyboard shortcut for Alt+O to open Obsidian vault browser
|
// Alt+O is now handled by the tool system via overrides.tsx
|
||||||
useEffect(() => {
|
// It selects the ObsidianNote tool, which waits for canvas click before deploying
|
||||||
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])
|
|
||||||
|
|
||||||
// Listen for open-fathom-meetings event - now creates a shape instead of modal
|
// Listen for open-fathom-meetings event - now creates a shape instead of modal
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -478,7 +478,7 @@ export const overrides: TLUiOverrides = {
|
||||||
openObsidianBrowser: {
|
openObsidianBrowser: {
|
||||||
id: "open-obsidian-browser",
|
id: "open-obsidian-browser",
|
||||||
label: "Open Obsidian Browser",
|
label: "Open Obsidian Browser",
|
||||||
kbd: "alt+o",
|
// Removed kbd: "alt+o" - Alt+O now selects the ObsidianNote tool instead
|
||||||
readonlyOk: true,
|
readonlyOk: true,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
// Trigger the Obsidian browser to open
|
// Trigger the Obsidian browser to open
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,15 @@ export class AutomergeDurableObject {
|
||||||
// Focus on the store data which is what actually changes
|
// Focus on the store data which is what actually changes
|
||||||
const storeData = doc.store || {}
|
const storeData = doc.store || {}
|
||||||
const storeKeys = Object.keys(storeData).sort()
|
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)
|
// Simple hash function (you could use a more sophisticated one if needed)
|
||||||
let hash = 0
|
let hash = 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue