mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
handle empty search note
This commit is contained in:
parent
616829464f
commit
9ca680f842
@ -9,8 +9,6 @@ const $refreshButton = $('#note-detail-search-refresh-results-button');
|
|||||||
function show() {
|
function show() {
|
||||||
$component.show();
|
$component.show();
|
||||||
|
|
||||||
console.log(noteDetailService.getActiveNote());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = JSON.parse(noteDetailService.getActiveNote().noteContent.content);
|
const json = JSON.parse(noteDetailService.getActiveNote().noteContent.content);
|
||||||
|
|
||||||
|
@ -116,8 +116,19 @@ async function prepareRealBranch(parentNote) {
|
|||||||
|
|
||||||
async function prepareSearchBranch(note) {
|
async function prepareSearchBranch(note) {
|
||||||
const fullNote = await noteDetailService.loadNote(note.noteId);
|
const fullNote = await noteDetailService.loadNote(note.noteId);
|
||||||
|
|
||||||
|
console.log("ZZZ", fullNote.noteContent.content);
|
||||||
|
|
||||||
|
if (!fullNote.noteContent.content || !fullNote.noteContent.content.trim()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const json = JSON.parse(fullNote.noteContent.content);
|
const json = JSON.parse(fullNote.noteContent.content);
|
||||||
|
|
||||||
|
if (!json.searchString || !json.searchString.trim()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const results = (await server.get('search/' + encodeURIComponent(json.searchString)))
|
const results = (await server.get('search/' + encodeURIComponent(json.searchString)))
|
||||||
.filter(res => res.noteId !== note.noteId); // this is necessary because title of the search note is often the same as the search text which would match and create circle
|
.filter(res => res.noteId !== note.noteId); // this is necessary because title of the search note is often the same as the search text which would match and create circle
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user