Rename UI to LED Editor and improve mobile editor layout
Use "LED Editor" in page titles and the home heading. On narrow viewports, make the file tree an off-canvas drawer with backdrop, hamburger toggle, Escape to close, and auto-close after opening a file. Add safe-area and tap-target tweaks, cache-bust static assets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -705,7 +705,43 @@ class TextEditor {
|
||||
this.hideCompletionDropdown();
|
||||
}
|
||||
|
||||
isMobileViewport() {
|
||||
return typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
|
||||
}
|
||||
|
||||
setMobileSidebarOpen(open) {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const backdrop = document.getElementById('sidebar-backdrop');
|
||||
const toggle = document.getElementById('sidebar-toggle');
|
||||
if (!sidebar || !backdrop || !toggle) return;
|
||||
sidebar.classList.toggle('is-open', open);
|
||||
backdrop.classList.toggle('is-open', open);
|
||||
backdrop.hidden = !open;
|
||||
toggle.setAttribute('aria-expanded', String(open));
|
||||
}
|
||||
|
||||
setupMobileSidebar() {
|
||||
const toggle = document.getElementById('sidebar-toggle');
|
||||
const backdrop = document.getElementById('sidebar-backdrop');
|
||||
if (!toggle || !backdrop) return;
|
||||
toggle.addEventListener('click', () => {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const isOpen = sidebar?.classList.contains('is-open');
|
||||
this.setMobileSidebarOpen(!isOpen);
|
||||
});
|
||||
backdrop.addEventListener('click', () => this.setMobileSidebarOpen(false));
|
||||
document.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'Escape') {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
if (sidebar?.classList.contains('is-open')) {
|
||||
this.setMobileSidebarOpen(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupEventListeners() {
|
||||
this.setupMobileSidebar();
|
||||
const persistSession = () => {
|
||||
this.saveSessionState();
|
||||
};
|
||||
@@ -1061,6 +1097,9 @@ class TextEditor {
|
||||
await this.toggleDirectory(path);
|
||||
} else if (!isDirectory) {
|
||||
this.openFile(path);
|
||||
if (this.isMobileViewport()) {
|
||||
this.setMobileSidebarOpen(false);
|
||||
}
|
||||
} else {
|
||||
this.renderFileTree();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user