úprava funkcí dir tree a přejmenování

master
David Zálešák 4 years ago
parent 6329bacff8
commit 9f31a4f171

@ -52,7 +52,7 @@ class Controller {
}
redrawDirTree(view) {
this.model.dirTree().then(
this.model.getDirTree().then(
function (value) {
view.removeDirTree();
view.drawDirTree(value, undefined, this);
@ -87,7 +87,7 @@ class Controller {
saveFile() {
var textArea = document.getElementsByTagName("textarea")[0];
this.model.saveFile(this.openedFile, textArea.value)
this.model.saveFile(this.openedFile, textArea.value);
this.openedFileValue = textArea.value;
this.saveButton()
}

@ -25,23 +25,24 @@ class Model {
let dirtree = [dir];
for (let i = 0; i < list.length; i++) {
dirtree[i + 1] = list[i];
let itemStat = await pfs.stat(dirtree[0] + dirtree[i + 1]);
let itemStat = await pfs.stat(dir + list[i]);
if (itemStat.isDirectory()) {
dirtree[i + 1] = await this.dirList(dirtree[0] + dirtree[i + 1] + "/");
dirtree[i + 1] = await this.dirList(dir + list[i] + "/");
} else {
dirtree[i + 1] = list[i];
}
}
return dirtree;
}
async dirTree() {
async getDirTree() {
var baseDir = localStorage.getItem("baseDir");
var stat = await pfs.stat(baseDir).catch((e) => {});
if (stat == null) {
var baseDir = "/";
var baseDir = dir;
}
var tree = await this.dirList(baseDir);

@ -13,7 +13,6 @@ class View {
tag.classList.add("caret");
ulToAdd.appendChild(tag);
if (dirtree.length > 1) {
var newul = document.createElement("ul");
newul.classList.add("nested");