diff --git a/public/js/views/editor.js b/public/js/views/editor.js
index 06e4baa..2829d60 100644
--- a/public/js/views/editor.js
+++ b/public/js/views/editor.js
@@ -3,7 +3,7 @@
import { api } from '../api.js';
export async function renderEditor(app) {
- const { id, libraryId } = app.state.params;
+ const { id, projectId, libraryId } = app.state.params;
let doc = null;
let libraries = [];
@@ -12,7 +12,7 @@ export async function renderEditor(app) {
doc = await api.getDocument(id);
} catch (e) {
app.showToast('Failed to load document', 'error');
- app.navigate('dashboard');
+ app.navigate(projectId ? 'project' : 'projects', { id: projectId });
return;
}
}
@@ -25,6 +25,30 @@ export async function renderEditor(app) {
const isNew = !id;
const appEl = document.getElementById('app');
+ // Determine back navigation target
+ const backTarget = projectId
+ ? { view: 'project', params: { id: projectId } }
+ : { view: 'projects', params: {} };
+
+ const backToParent = () => {
+ if (projectId) {
+ app.navigate('project', { id: projectId });
+ } else {
+ app.navigate('projects');
+ }
+ };
+
+ // Mobile menu functions
+ window.toggleEditorMenu = function() {
+ const menu = document.getElementById('editor-menu');
+ if (menu) menu.classList.toggle('open');
+ };
+
+ window.closeEditorMenu = function() {
+ const menu = document.getElementById('editor-menu');
+ if (menu) menu.classList.remove('open');
+ };
+
let formData = {
title: doc?.title || '',
content: doc?.content || '',
@@ -41,10 +65,27 @@ export async function renderEditor(app) {
function render() {
appEl.innerHTML = `
+