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) { function openFile(fileName) {
currentFile = fileName; currentFile = fileName;
editor.setValue(files[fileName]); editor.setValue(files[fileName]);
@ -289,6 +291,8 @@
updateStatusBar(); updateStatusBar();
} }
funcOpenFile = openFile;
function getFileMode(fileName) { function getFileMode(fileName) {
const extension = fileName.split(".").pop().toLowerCase(); const extension = fileName.split(".").pop().toLowerCase();
switch (extension) { switch (extension) {
@ -319,6 +323,8 @@
} }
} }
funcGetFileMode = getFileMode;
function updateStatusBar() { function updateStatusBar() {
const statusBar = document.querySelector(".status-bar"); const statusBar = document.querySelector(".status-bar");
const mode = editor.getOption("mode"); const mode = editor.getOption("mode");
@ -327,6 +333,8 @@
}`; }`;
} }
funcUpdateStatusBar = updateStatusBar;
window.renameFile = (oldName) => { window.renameFile = (oldName) => {
const newName = prompt("Enter new file name:", oldName); const newName = prompt("Enter new file name:", oldName);
if (newName && newName !== oldName) { if (newName && newName !== oldName) {
@ -369,6 +377,8 @@
} }
} }
funcQuickSave = quickSaveFile;
async function saveAs(content) { async function saveAs(content) {
const blob = new Blob([content], { type: "text/plain" }); const blob = new Blob([content], { type: "text/plain" });
const extension = currentFile.split(".").pop().toLowerCase(); const extension = currentFile.split(".").pop().toLowerCase();
@ -385,6 +395,8 @@
await fileStream.close(); await fileStream.close();
} }
funcSaveAs = saveAs
document.getElementById("save-icon").addEventListener("click", () => { document.getElementById("save-icon").addEventListener("click", () => {
files[currentFile] = editor.getValue(); files[currentFile] = editor.getValue();
const srcCode = files[currentFile]; const srcCode = files[currentFile];
@ -521,16 +533,23 @@
}); });
// Toggle file explorer // Toggle file explorer
const toggleExplorer = document.getElementById("toggle-explorer"); toggleExplorer = document.getElementById("toggle-explorer");
const fileExplorer = document.querySelector(".file-explorer"); fileExplorer = document.querySelector(".file-explorer");
let isExplorerVisible = true; let isExplorerVisible = true;
toggleExplorer.addEventListener("click", () => {
function te() {
isExplorerVisible = !isExplorerVisible; isExplorerVisible = !isExplorerVisible;
fileExplorer.classList.toggle("hidden", !isExplorerVisible); fileExplorer.classList.toggle("hidden", !isExplorerVisible);
toggleExplorer.classList.toggle("flipped", !isExplorerVisible); toggleExplorer.classList.toggle("flipped", !isExplorerVisible);
}
toggleExplorer.addEventListener("click", () => {
te()
}); });
funcToggleExplorer = te
updateFileList(); updateFileList();
openFile("Welcome2SneedCode.md"); openFile("Welcome2SneedCode.md");
}); });