mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
saved search note now has refresh button, closes #369
This commit is contained in:
parent
f479c0e10e
commit
7bbf797caf
@ -107,6 +107,8 @@ $("#logout-button").click(() => {
|
||||
|
||||
$("#tree").on("click", ".unhoist-button", hoistedNoteService.unhoist);
|
||||
|
||||
$("#tree").on("click", ".refresh-search-button", searchNotesService.refreshSearch);
|
||||
|
||||
$("body").on("click", "a.external", function () {
|
||||
window.open($(this).attr("href"), '_blank');
|
||||
});
|
||||
|
@ -1,6 +1,5 @@
|
||||
import noteDetailService from "./note_detail.js";
|
||||
import treeService from "./tree.js";
|
||||
import infoService from './info.js';
|
||||
import searchNotesService from "./search_notes.js";
|
||||
|
||||
const $searchString = $("#search-string");
|
||||
const $component = $('#note-detail-search');
|
||||
@ -31,9 +30,7 @@ function getContent() {
|
||||
$refreshButton.click(async () => {
|
||||
await noteDetailService.saveNoteIfChanged();
|
||||
|
||||
treeService.reload();
|
||||
|
||||
infoService.showMessage('Tree has been refreshed.');
|
||||
await searchNotesService.refreshSearch();
|
||||
});
|
||||
|
||||
export default {
|
||||
|
@ -96,6 +96,15 @@ async function saveSearch() {
|
||||
resetSearch();
|
||||
}
|
||||
|
||||
async function refreshSearch() {
|
||||
const activeNode = treeService.getActiveNode();
|
||||
|
||||
activeNode.load(true);
|
||||
activeNode.setExpanded(true);
|
||||
|
||||
infoService.showMessage("Saved search note refreshed.");
|
||||
}
|
||||
|
||||
function init() {
|
||||
const hashValue = treeService.getHashValueFromAddress();
|
||||
|
||||
@ -129,6 +138,7 @@ export default {
|
||||
toggleSearch,
|
||||
resetSearch,
|
||||
showSearch,
|
||||
refreshSearch,
|
||||
doSearch,
|
||||
init
|
||||
};
|
@ -453,6 +453,14 @@ function initFancyTree(tree) {
|
||||
|
||||
$span.append(unhoistButton);
|
||||
}
|
||||
|
||||
const note = await treeCache.getNote(node.data.noteId);
|
||||
|
||||
if (note.type === 'search' && $span.find('.refresh-search-button').length === 0) {
|
||||
const refreshSearchButton = $('<span> <span class="refresh-search-button jam jam-refresh" title="Refresh saved search results"></span></span>');
|
||||
|
||||
$span.append(refreshSearchButton);
|
||||
}
|
||||
},
|
||||
// this is done to automatically lazy load all expanded search notes after tree load
|
||||
loadChildren: function(event, data) {
|
||||
|
@ -133,4 +133,10 @@ li.dropdown-submenu:hover > ul.dropdown-menu {
|
||||
.dropdown-menu > li > a:hover:after {
|
||||
text-decoration: underline;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.refresh-search-button {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
|
||||
<span>
|
||||
|
||||
<button type="button" class="btn btn-primary" id="note-detail-search-refresh-results-button">Refresh tree</button>
|
||||
<button type="button" class="btn btn-primary" id="note-detail-search-refresh-results-button">Refresh search results</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user