mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-01 17:10:24 +08:00
fix(electron): prevent beforeunload prompt by using autosave (#642)
* fix(electron): prevent beforeunload prompt by using autosave - Enable draw.io autosave and handle autosave events to update chartXML - Clear modified state after autosave to avoid beforeunload prompts - Disable confirmExit in draw.io configuration - Set modified=false and keepmodified=false URL parameters - Fix session save condition to also save when only diagram exists * fix: persist diagram-only saves and ref typing * fix: harden persistence checks and export timeout
This commit is contained in:
@@ -75,6 +75,18 @@ export function isIndexedDBAvailable(): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if IndexedDB is actually usable (not just present).
|
||||
export async function isIndexedDBUsable(): Promise<boolean> {
|
||||
if (!isIndexedDBAvailable()) return false
|
||||
try {
|
||||
const db = await getDB()
|
||||
db.close()
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// CRUD Operations
|
||||
export async function getAllSessionMetadata(): Promise<SessionMetadata[]> {
|
||||
if (!isIndexedDBAvailable()) return []
|
||||
|
||||
Reference in New Issue
Block a user