wow even more hackability!
This commit is contained in:
parent
eb9c6db880
commit
bc40084fbd
1 changed files with 22 additions and 3 deletions
25
index.html
25
index.html
|
@ -282,6 +282,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
funcUpdateList = updateFileList;
|
||||
|
||||
function openFile(fileName) {
|
||||
currentFile = fileName;
|
||||
editor.setValue(files[fileName]);
|
||||
|
@ -289,6 +291,8 @@
|
|||
updateStatusBar();
|
||||
}
|
||||
|
||||
funcOpenFile = openFile;
|
||||
|
||||
function getFileMode(fileName) {
|
||||
const extension = fileName.split(".").pop().toLowerCase();
|
||||
switch (extension) {
|
||||
|
@ -319,6 +323,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
funcGetFileMode = getFileMode;
|
||||
|
||||
function updateStatusBar() {
|
||||
const statusBar = document.querySelector(".status-bar");
|
||||
const mode = editor.getOption("mode");
|
||||
|
@ -327,6 +333,8 @@
|
|||
}`;
|
||||
}
|
||||
|
||||
funcUpdateStatusBar = updateStatusBar;
|
||||
|
||||
window.renameFile = (oldName) => {
|
||||
const newName = prompt("Enter new file name:", oldName);
|
||||
if (newName && newName !== oldName) {
|
||||
|
@ -369,6 +377,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
funcQuickSave = quickSaveFile;
|
||||
|
||||
async function saveAs(content) {
|
||||
const blob = new Blob([content], { type: "text/plain" });
|
||||
const extension = currentFile.split(".").pop().toLowerCase();
|
||||
|
@ -385,6 +395,8 @@
|
|||
await fileStream.close();
|
||||
}
|
||||
|
||||
funcSaveAs = saveAs
|
||||
|
||||
document.getElementById("save-icon").addEventListener("click", () => {
|
||||
files[currentFile] = editor.getValue();
|
||||
const srcCode = files[currentFile];
|
||||
|
@ -521,16 +533,23 @@
|
|||
});
|
||||
|
||||
// Toggle file explorer
|
||||
const toggleExplorer = document.getElementById("toggle-explorer");
|
||||
const fileExplorer = document.querySelector(".file-explorer");
|
||||
toggleExplorer = document.getElementById("toggle-explorer");
|
||||
fileExplorer = document.querySelector(".file-explorer");
|
||||
let isExplorerVisible = true;
|
||||
|
||||
toggleExplorer.addEventListener("click", () => {
|
||||
|
||||
function te() {
|
||||
isExplorerVisible = !isExplorerVisible;
|
||||
fileExplorer.classList.toggle("hidden", !isExplorerVisible);
|
||||
toggleExplorer.classList.toggle("flipped", !isExplorerVisible);
|
||||
}
|
||||
|
||||
toggleExplorer.addEventListener("click", () => {
|
||||
te()
|
||||
});
|
||||
|
||||
funcToggleExplorer = te
|
||||
|
||||
updateFileList();
|
||||
openFile("Welcome2SneedCode.md");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue