mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
allow refreshing saved note, closes #304
This commit is contained in:
parent
05aee884b6
commit
c8ec86e537
@ -1,7 +1,9 @@
|
|||||||
import noteDetailService from "./note_detail.js";
|
import noteDetailService from "./note_detail.js";
|
||||||
|
import treeService from "./tree.js";
|
||||||
|
|
||||||
const $searchString = $("#search-string");
|
const $searchString = $("#search-string");
|
||||||
const $component = $('#note-detail-search');
|
const $component = $('#note-detail-search');
|
||||||
|
const $refreshButton = $('#note-detail-search-refresh-results-button');
|
||||||
|
|
||||||
function getContent() {
|
function getContent() {
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
@ -25,6 +27,8 @@ function show() {
|
|||||||
$searchString.on('input', noteDetailService.noteChanged);
|
$searchString.on('input', noteDetailService.noteChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$refreshButton.click(() => treeService.reload());
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getContent,
|
getContent,
|
||||||
show,
|
show,
|
||||||
|
@ -352,6 +352,7 @@ function clearSelectedNodes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function treeInitialized() {
|
async function treeInitialized() {
|
||||||
|
// - is used in mobile to indicate that we don't want to activate any note after load
|
||||||
if (startNotePath === '-') {
|
if (startNotePath === '-') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -363,7 +364,6 @@ async function treeInitialized() {
|
|||||||
startNotePath = null;
|
startNotePath = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - is used in mobile to indicate that we don't want to activate any note after load
|
|
||||||
if (startNotePath) {
|
if (startNotePath) {
|
||||||
const node = await activateNote(startNotePath);
|
const node = await activateNote(startNotePath);
|
||||||
|
|
||||||
@ -438,6 +438,16 @@ function initFancyTree(tree) {
|
|||||||
|
|
||||||
$span.append(unhoistButton);
|
$span.append(unhoistButton);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// this is done to automatically lazy load all expanded search notes after tree load
|
||||||
|
loadChildren: function(event, data) {
|
||||||
|
data.node.visit(function(subNode){
|
||||||
|
// Load all lazy/unloaded child nodes
|
||||||
|
// (which will trigger `loadChildren` recursively)
|
||||||
|
if( subNode.isUndefined() && subNode.isExpanded() ) {
|
||||||
|
subNode.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ async function prepareNode(branch) {
|
|||||||
extraClasses: await getExtraClasses(note),
|
extraClasses: await getExtraClasses(note),
|
||||||
icon: await getIcon(note),
|
icon: await getIcon(note),
|
||||||
refKey: note.noteId,
|
refKey: note.noteId,
|
||||||
expanded: (note.type !== 'search' && branch.isExpanded) || hoistedNoteId === note.noteId
|
expanded: branch.isExpanded || hoistedNoteId === note.noteId
|
||||||
};
|
};
|
||||||
|
|
||||||
if (note.hasChildren() || note.type === 'search') {
|
if (note.hasChildren() || note.type === 'search') {
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
<div id="note-detail-search" class="note-detail-component">
|
<div id="note-detail-search" class="note-detail-component">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<strong>Search string: </strong>
|
<strong>Search string: </strong>
|
||||||
<textarea rows="4" cols="50" id="search-string"></textarea>
|
<textarea rows="4" cols="40" id="search-string"></textarea>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-primary" id="note-detail-search-refresh-results-button">Refresh tree</button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user