trilium/src/public/javascripts/services/note_detail_search.js

39 lines
880 B
JavaScript
Raw Normal View History

import noteDetailService from "./note_detail.js";
import treeService from "./tree.js";
const $searchString = $("#search-string");
2018-11-08 17:30:35 +08:00
const $component = $('#note-detail-search');
const $refreshButton = $('#note-detail-search-refresh-results-button');
function getContent() {
2019-01-09 05:48:53 +08:00
return JSON.stringify({
searchString: $searchString.val()
});
}
2018-03-28 09:46:38 +08:00
function show() {
2018-11-08 17:30:35 +08:00
$component.show();
try {
const json = JSON.parse(noteDetailService.getCurrentNote().content);
$searchString.val(json.searchString);
}
catch (e) {
console.log(e);
$searchString.val('');
}
$searchString.on('input', noteDetailService.noteChanged);
}
$refreshButton.click(() => treeService.reload());
export default {
getContent,
2018-03-28 09:46:38 +08:00
show,
focus: () => null,
onNoteChange: () => null,
cleanup: () => null,
scrollToTop: () => null
}