saved search can now be created from the search dialog

This commit is contained in:
azivner
2018-03-23 23:08:29 -04:00
parent ac978c3fa7
commit f8649feea4
8 changed files with 142 additions and 113 deletions

View File

@@ -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);

View File

@@ -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();