fix image urls, fix context menu

This commit is contained in:
Nystik
2026-03-10 20:49:10 +01:00
parent b48ef720b8
commit d8d12054b7
9 changed files with 157 additions and 39 deletions

View File

@@ -119,6 +119,19 @@ window.close = function () {
console.log("[obsidian-bridge] window.close() blocked");
};
// Suppress the browser's native context menu without breaking Obsidian's.
// Problem: preventDefault() blocks the browser menu but also sets
// event.defaultPrevented=true, which Obsidian checks to bail out.
// Solution: call preventDefault() then shadow defaultPrevented to return false.
window.addEventListener(
"contextmenu",
(e) => {
e.preventDefault();
Object.defineProperty(e, "defaultPrevented", { get: () => false });
},
true,
);
// Pre-populate fs metadata cache synchronously before app.js runs.
// This ensures existsSync() works for the vault path during startup.
(function initMetadataCache() {