Skip to content

Commit

Permalink
fix: capitalization issue in lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
levirs565 committed Aug 21, 2023
1 parent a4ebd20 commit b1c4a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/NoteComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
};
async function createCurrentNote() {
const path = note.getPath();
const path = note.getPath(true);
const plugin = getPlugin();
const file = await vault.createNote(path);
openFile(plugin.app, file);
Expand All @@ -36,7 +36,7 @@
function openLookup() {
const { app, workspace } = getPlugin();
new LookupModal(app, workspace, note.getPath()).open();
new LookupModal(app, workspace, note.getPath(true)).open();
}
function openMenu(e: MouseEvent) {
Expand Down
6 changes: 3 additions & 3 deletions src/engine/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export class Note {
if (rescursive) this.children.forEach((child) => child.sortChildren(rescursive));
}

getPath() {
getPath(original = false) {
const component: string[] = [];
const notes = this.getPathNotes();

if (notes.length === 1) return notes[0].name;
if (notes.length === 1) return original ? notes[0].originalName : notes[0].name;

for (const note of notes) {
if (!note.parent && note.name === "root") continue;
component.push(note.name);
component.push(original ? note.originalName : note.name);
}

return component.join(".");
Expand Down
4 changes: 2 additions & 2 deletions src/modal/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class LookupModal extends SuggestModal<LookupItem | null> {
note,
vault,
};
if (path === query) {
if (path === queryLowercase) {
currentFoundExact = true;
result.unshift(item);
continue;
Expand All @@ -53,7 +53,7 @@ export class LookupModal extends SuggestModal<LookupItem | null> {
foundExact = foundExact && currentFoundExact;
}

if (!foundExact && query.trim().length > 0) result.unshift(null);
if (!foundExact && queryLowercase.trim().length > 0) result.unshift(null);

return result;
}
Expand Down

0 comments on commit b1c4a67

Please sign in to comment.