improvements in search UI

This commit is contained in:
zadam
2020-11-26 23:00:27 +01:00
parent 02043d9109
commit eaed7ec86f
27 changed files with 251 additions and 252 deletions

View File

@@ -2,6 +2,7 @@ import Branch from "../entities/branch.js";
import NoteShort from "../entities/note_short.js";
import Attribute from "../entities/attribute.js";
import server from "./server.js";
import appContext from "./app_context.js";
import NoteComplement from "../entities/note_complement.js";
/**
@@ -192,8 +193,12 @@ class TreeCache {
await this.loadParents(resp, true);
this.addResp(resp);
const searchNoteIds = [];
for (const note of resp.notes) {
if (note.type === 'search') {
searchNoteIds.push(note.noteId);
const searchResultNoteIds = await server.get('search-note/' + note.noteId);
if (!Array.isArray(searchResultNoteIds)) {
@@ -227,6 +232,10 @@ class TreeCache {
});
}
}
if (searchNoteIds.length > 0) {
appContext.triggerEvent('searchResultsUpdated', {searchNoteIds});
}
}
/** @return {NoteShort[]} */