file search working. opening not so much
This commit is contained in:
parent
9b9c5add18
commit
c87cf5c8ee
3 changed files with 8 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ pub fn _search_files(path: &Path, searchstring: &str, filter: &Vec<String>) -> V
|
|||
if metadata.is_file() {
|
||||
if entry_match(&dir_entry, searchstring, filter) {
|
||||
let div = search_result_div_from_dir_entry(&dir_entry).to_html();
|
||||
println!("{:?}", div);
|
||||
// println!("{:?}", div);
|
||||
search_results.push(div);
|
||||
}
|
||||
} else if metadata.is_dir() {
|
||||
|
|
@ -66,9 +66,8 @@ fn entry_match(dir_entry: &DirEntry, searchstring: &str, filter: &Vec<String>) -
|
|||
fn search_result_div_from_dir_entry(dir_entry: &DirEntry) -> HtmlTag {
|
||||
let mut file_div = HtmlTag::new("div")
|
||||
.with_class("filetree-node")
|
||||
.with_id(&format!("{}", dir_entry.path().to_string_lossy()))
|
||||
.with_attribute("style", "visibility: hidden; height: 0px;");
|
||||
let mut file_button = HtmlTag::new("button").with_class("filetree-file-button");
|
||||
.with_id(&format!("{}", dir_entry.path().to_string_lossy()));
|
||||
let mut file_button = HtmlTag::new("button").with_class("file-search-button");
|
||||
match dir_entry
|
||||
.path()
|
||||
.extension()
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ function search_files(){
|
|||
var text = search_input.innerText;
|
||||
invoke("search_files", { searchstring: text, basepath: "$HOME/Documents/Knowledgebase", filter: ["md"]}).then(
|
||||
(ret) => {
|
||||
var tag_id = document.getElementById('rendered_markdown');
|
||||
var tag_id = document.getElementById('file-search-results');
|
||||
var result_div = "";
|
||||
ret.array.forEach(element => {
|
||||
console.log(ret);
|
||||
ret.forEach(element => {
|
||||
result_div += element;
|
||||
});
|
||||
console.log(result_div);
|
||||
tag_id.innerHTML = "<pre>".concat("", result_div).concat("", "</pre>");
|
||||
// tag_id.innerHTML = assetUrl.concat(" ", ' \n <img src="'.concat("", assetUrl).concat("", '" alt="Girl in a jacket" width="500" height="600">'))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
<dialog id="file-search-dialog">
|
||||
|
||||
<div id="file-search-dialog-input" contenteditable></div>
|
||||
<div id="file-search-results"/>
|
||||
</dialog>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue