support for multiple folder levels

This commit is contained in:
Nic Limper
2025-02-11 20:00:06 +01:00
parent 15a9728f45
commit d8fa96b20e
2 changed files with 6 additions and 8 deletions

View File

@@ -1,4 +1,3 @@
<!--This is the plain html source of the hex encoded Editor-Page embedded in SPIFFSEditor.cpp -->
<!DOCTYPE html>
<html lang="en">
@@ -626,9 +625,9 @@
leaf.onclick = function (e) {
treeRoot.removeChild(treeRoot.childNodes[0]);
if (name == "..") {
httpGet(treeRoot, "/");
httpGet(treeRoot, path === "/" ? "/" : path.substring(0, path.lastIndexOf('/')) || "/");
} else {
httpGet(treeRoot, "/" + name);
httpGet(treeRoot, path + (path != "/" ? "/" : "") + name);
}
};
leaf.oncontextmenu = function (e) {
@@ -654,9 +653,6 @@
sortByKey(items, 'name');
var list = ce("ul");
parent.appendChild(list);
if (path != "/") {
list.appendChild(createDirLeaf("/", "..", 0));
}
var ll = items.length;
for (var i = 0; i < ll; i++) {
if (items[i].type === "file") {
@@ -666,7 +662,9 @@
list.insertBefore(createDirLeaf(path, items[i].name, items[i].size), list.firstChild);
}
}
if (path != "/") {
list.insertBefore(createDirLeaf(path, "..", 0), list.firstChild);
}
}
function isTextFile(path) {
@@ -863,7 +861,7 @@
editor.loadUrl(vars.file);
};
</script>
<script id='ace' src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js" type="text/javascript"
<script id='ace' src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.37.2/ace.js" type="text/javascript"
charset="utf-8"></script>
<script>
if (typeof ace.edit == "undefined") {