diff --git a/modules/ui/obsidian-notes-editor.js b/modules/ui/obsidian-notes-editor.js index 86a28946..81878548 100644 --- a/modules/ui/obsidian-notes-editor.js +++ b/modules/ui/obsidian-notes-editor.js @@ -28,7 +28,9 @@ async function findOrCreateNote(elementId, elementType, coordinates) { if (note) { INFO && console.log("Found note by FMG ID:", note.path); - return note; + closeDialogs("#obsidianNoteLoading"); + // Show dialog with option to open linked note or choose different one + return await showLinkedNoteDialog(note, elementId, elementType, coordinates); } // Find by coordinates @@ -57,6 +59,46 @@ async function findOrCreateNote(elementId, elementType, coordinates) { return await showNoteSelectionDialog(matches, elementId, elementType, coordinates); } +async function showLinkedNoteDialog(note, elementId, elementType, coordinates) { + return new Promise((resolve, reject) => { + alertMessage.innerHTML = ` +
✓ Found linked note:
+This element is already linked to the note above. You can open it or choose a different note.
+