From 4e8b9e9b0dc80efc85d1100d5734e69b6e0764c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 06:13:53 +0000 Subject: [PATCH] fix(obsidian): remove async from button handler for jQuery UI compatibility jQuery UI dialog buttons don't work properly with async function handlers. The Browse button was showing up blank/broken. Changed Browse button handler from: - async function with await - to regular function with .then()/.catch() This matches the pattern used for the Search button and should make all three buttons (Search, Browse, Cancel) work properly. --- modules/ui/obsidian-notes-editor.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/ui/obsidian-notes-editor.js b/modules/ui/obsidian-notes-editor.js index 5b266bb8..6db4c468 100644 --- a/modules/ui/obsidian-notes-editor.js +++ b/modules/ui/obsidian-notes-editor.js @@ -48,19 +48,20 @@ function showSearchMethodDialog(elementId, elementType, coordinates) { closeDialogs("#obsidianNoteLoading"); }); }, - "Browse": async function () { + "Browse": function () { $(this).dialog("close"); - try { - const noteData = await promptCreateNewNote(elementId, elementType, coordinates); - showMarkdownEditor(noteData, elementType, elementId, coordinates); - } catch (error) { - if (error.message !== "Cancelled") { - ERROR && console.error("Failed to load note:", error); - tip("Failed to load Obsidian note: " + error.message, true, "error", 5000); - } - } + promptCreateNewNote(elementId, elementType, coordinates) + .then(noteData => { + showMarkdownEditor(noteData, elementType, elementId, coordinates); + }) + .catch(error => { + if (error.message !== "Cancelled") { + ERROR && console.error("Failed to load note:", error); + tip("Failed to load Obsidian note: " + error.message, true, "error", 5000); + } + }); }, - Cancel: function () { + "Cancel": function () { $(this).dialog("close"); } },