diff --git a/modules/ui/obsidian-notes-editor.js b/modules/ui/obsidian-notes-editor.js
index e8d5964f..8af8582f 100644
--- a/modules/ui/obsidian-notes-editor.js
+++ b/modules/ui/obsidian-notes-editor.js
@@ -5,19 +5,67 @@
function editObsidianNote(elementId, elementType, coordinates) {
const {x, y} = coordinates;
- // Show loading dialog
- showLoadingDialog();
+ // Show choice dialog: automatic search or manual browse
+ showSearchMethodDialog(elementId, elementType, coordinates);
+}
- // Try to find note by FMG ID first, then by coordinates
- findOrCreateNote(elementId, elementType, coordinates)
- .then(noteData => {
- showMarkdownEditor(noteData, elementType, elementId, coordinates);
- })
- .catch(error => {
- ERROR && console.error("Failed to load note:", error);
- tip("Failed to load Obsidian note: " + error.message, true, "error", 5000);
- closeDialogs("#obsidianNoteLoading");
- });
+function showSearchMethodDialog(elementId, elementType, coordinates) {
+ const element = getElementData(elementId, elementType);
+ const elementName = element.name || elementId;
+
+ alertMessage.innerHTML = `
+
+
${elementName}
+
How would you like to find the note for this ${elementType}?
+
+
+
🔍 Automatic Search
+
Search by linked ID or nearby coordinates
+
+
+
+
📁 Browse Manually
+
Browse your vault's folder tree
+
+
+ `;
+
+ $("#alert").dialog({
+ title: "Select Note",
+ width: "450px",
+ buttons: {
+ "🔍 Search": function () {
+ $(this).dialog("close");
+ // Show loading and do automatic search
+ showLoadingDialog();
+ findOrCreateNote(elementId, elementType, coordinates)
+ .then(noteData => {
+ showMarkdownEditor(noteData, elementType, elementId, coordinates);
+ })
+ .catch(error => {
+ ERROR && console.error("Failed to load note:", error);
+ tip("Failed to load Obsidian note: " + error.message, true, "error", 5000);
+ closeDialogs("#obsidianNoteLoading");
+ });
+ },
+ "📁 Browse": async 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);
+ }
+ }
+ },
+ Cancel: function () {
+ $(this).dialog("close");
+ }
+ },
+ position: {my: "center", at: "center", of: "svg"}
+ });
}
async function findOrCreateNote(elementId, elementType, coordinates) {