trilium/src/public/javascripts/services/note_detail_search.js
2019-01-08 23:32:03 +01:00

39 lines
880 B
JavaScript

import noteDetailService from "./note_detail.js";
import treeService from "./tree.js";
const $searchString = $("#search-string");
const $component = $('#note-detail-search');
const $refreshButton = $('#note-detail-search-refresh-results-button');
function getContent() {
return JSON.stringify({
searchString: $searchString.val()
});
}
function show() {
$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,
show,
focus: () => null,
onNoteChange: () => null,
cleanup: () => null,
scrollToTop: () => null
}