search and select from search working.scroll in search window not yet working

This commit is contained in:
Iaphetes 2025-02-01 13:16:08 +01:00
parent c87cf5c8ee
commit 95867768c4
3 changed files with 41 additions and 7 deletions

View file

@ -1,5 +1,6 @@
const { convertFileSrc, invoke } = window.__TAURI__.core;
import { handle_file_select } from "./filesystem.js";
var search_input = document.getElementById("file-search-dialog-input");
search_input.addEventListener('input', () => {
search_files();
@ -17,8 +18,31 @@ function search_files(){
result_div += element;
});
console.log(result_div);
tag_id.innerHTML = "<pre>".concat("", result_div).concat("", "</pre>");
tag_id.innerHTML = result_div;
// tag_id.innerHTML = assetUrl.concat(" ", ' \n <img src="'.concat("", assetUrl).concat("", '" alt="Girl in a jacket" width="500" height="600">'))
}
);
}
let filetree = document.getElementById('file-search-results');
// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: true, subtree: true };
// Callback function to execute when mutations are observed
const callback = (mutationList, observer) => {
console.log("updating on click");
var anchors = document.getElementsByClassName("file-search-button");
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
anchor.onclick = function() {
handle_file_select(this.parentElement.id);
};
};
};
const observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(filetree, config);