Skip to content

Build your personal knowledge base with Trilium Notes

fix "show in full text search" in jump to note dialog

zadam4078b32e9da9
diff --git a/src/public/app/dialogs/jump_to_note.js b/src/public/app/dialogs/jump_to_note.js
index 378b6876db..d8a05b3e52 100644
--- a/src/public/app/dialogs/jump_to_note.js
+++ b/src/public/app/dialogs/jump_to_note.js
@@ -47,10 +47,9 @@ function showInFullText(e) {
e.preventDefault();
e.stopPropagation();
- const searchText = $autoComplete.val();
+ const searchString = $autoComplete.val();
- appContext.triggerCommand('showSearch', {searchText});
- appContext.triggerCommand('searchForResults', {searchText});
+ appContext.triggerCommand('searchNotes', {searchString});
$dialog.modal('hide');
}
diff --git a/src/public/app/services/date_notes.js b/src/public/app/services/date_notes.js
index 7b7a54a2dd..42a9a46bd7 100644
--- a/src/public/app/services/date_notes.js
+++ b/src/public/app/services/date_notes.js
@@ -43,20 +43,21 @@ async function createSqlConsole() {
}
/** @return {NoteShort} */
-async function createSearchNote(subTreeNoteId = null) {
+async function createSearchNote(opts = {}) {
const note = await server.post('search-note');
- if (subTreeNoteId) {
- await server.put(`notes/${note.noteId}/attributes`, [
- { type: 'label', name: 'subTreeNoteId', value: subTreeNoteId }
- ]);
+ const attrsToUpdate = [
+ opts.subTreeNoteId ? { type: 'label', name: 'subTreeNoteId', value: opts.subTreeNoteId } : undefined,
+ opts.searchString ? { type: 'label', name: 'searchString', value: opts.searchString } : undefined
+ ].filter(attr => !!attr);
+
+ if (attrsToUpdate.length > 0) {
+ await server.put(`notes/${note.noteId}/attributes`, attrsToUpdate);
}
await ws.waitForMaxKnownEntityChangeId();
- const noteShort = await treeCache.getNote(note.noteId);
-
- return noteShort;
+ return await treeCache.getNote(note.noteId);
}
export default {
diff --git a/src/public/app/services/dialog_command_executor.js b/src/public/app/services/dialog_command_executor.js
index 734fdf2efc..f422d8df32 100644
--- a/src/public/app/services/dialog_command_executor.js
+++ b/src/public/app/services/dialog_command_executor.js
@@ -67,8 +67,8 @@ export default class DialogCommandExecutor extends Component {
appContext.triggerCommand('focusOnDetail', {tabId: tabContext.tabId});
}
- async searchNotesCommand() {
- const searchNote = await dateNoteService.createSearchNote();
+ async searchNotesCommand({searchString, subTreeNoteId}) {
+ const searchNote = await dateNoteService.createSearchNote({searchString, subTreeNoteId});
const tabContext = await appContext.tabManager.openTabWithNote(searchNote.noteId, true);
@@ -78,11 +78,7 @@ export default class DialogCommandExecutor extends Component {
async searchInSubtreeCommand({notePath}) {
const noteId = treeService.getNoteIdFromNotePath(notePath);
- const searchNote = await dateNoteService.createSearchNote(noteId);
-
- const tabContext = await appContext.tabManager.openTabWithNote(searchNote.noteId, true);
-
- appContext.triggerCommand('focusOnSearchDefinition', {tabId: tabContext.tabId});
+ this.searchNotesCommand({subTreeNoteId: noteId});
}
showBackendLogCommand() {