wow even more hackability!

This commit is contained in:
The Ghost of FOSS' Future 2024-09-18 08:54:19 -05:00 committed by GitHub
parent eb9c6db880
commit bc40084fbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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");
});