mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-01-24 22:19:02 -06:00
saved search can now be created from the search dialog
This commit is contained in:
@@ -659,7 +659,7 @@ const noteTree = (function() {
|
||||
|
||||
const json = JSON.parse(note.detail.content);
|
||||
|
||||
const noteIds = await server.get('notes?search=' + encodeURIComponent(json.searchString));
|
||||
const noteIds = await server.get('search/' + encodeURIComponent(json.searchString));
|
||||
|
||||
for (const noteId of noteIds) {
|
||||
const noteTreeId = "virt" + randomString(10);
|
||||
|
||||
@@ -35,7 +35,7 @@ const searchTree = (function() {
|
||||
async function doSearch() {
|
||||
const searchText = $searchInput.val();
|
||||
|
||||
const noteIds = await server.get('notes?search=' + encodeURIComponent(searchText));
|
||||
const noteIds = await server.get('search/' + encodeURIComponent(searchText));
|
||||
|
||||
for (const noteId of noteIds) {
|
||||
await noteTree.expandToNote(noteId, {noAnimation: true, noEvents: true});
|
||||
@@ -60,7 +60,13 @@ const searchTree = (function() {
|
||||
|
||||
$doSearchButton.click(doSearch);
|
||||
|
||||
$saveSearchButton.click(() => alert("Save search"));
|
||||
$saveSearchButton.click(async () => {
|
||||
const {noteId} = await server.post('search/' + encodeURIComponent($searchInput.val()));
|
||||
|
||||
await noteTree.reload();
|
||||
|
||||
await noteTree.activateNode(noteId);
|
||||
});
|
||||
|
||||
$(document).bind('keydown', 'ctrl+s', e => {
|
||||
toggleSearch();
|
||||
|
||||
Reference in New Issue
Block a user