trilium/src/public/javascripts/services/note_detail_search.js
2018-03-27 21:46:38 -04:00

32 lines
No EOL
643 B
JavaScript

import noteDetailService from "./note_detail.js";
const $searchString = $("#search-string");
const $noteDetailSearch = $('#note-detail-search');
function getContent() {
JSON.stringify({
searchString: $searchString.val()
});
}
function show() {
$noteDetailSearch.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);
}
export default {
getContent,
show,
focus: () => null
}