UNIVERSAL EDITOR ROUTES IMPLEMENTATION
Ecosistema completo para organización y gestión de contenido con interfaces espaciales
🎯 Universal Editor Routes Implementation
Date: November 5, 2025
Status: ✅ Completed
Priority: Critical - Architecture Improvement
🎯 What Changed
Implemented a universal editor route structure where ONE component (EditorWorkspaceComponent) handles ALL contexts through clean, RESTful routes:
New Route Structure:
/space/{space}/editor → Blank canvas (create new)
/space/{space}/editor/page/:pageId → Edit existing page
/space/{space}/editor/universe/:universeId/page/:pageId → Edit page in universe
/space/{space}/editor/module/:moduleId → Create content for module
/space/{space}/editor/component/:componentId → Build reusable component (future)
/space/{space}/editor/world/:worldId/page/:pageId → Edit world page (legacy support)
Benefits:
- ✅ One Component - Single EditorWorkspaceComponent handles all contexts
- ✅ Reactive Context Detection - Component detects context from route params
- ✅ Clean Routes - RESTful, readable, bookmarkable URLs
- ✅ Extensible - Easy to add new contexts (components, templates, etc.)
- ✅ Backward Compatible - Legacy routes redirect automatically
📝 Files Changed
1. Routes Configuration
- ✅
libs/editor-web-lib/src/lib/editor.routes.ts- Restructured all routes to use universal format
- Added module, component, universe-scoped routes
- Legacy routes handled by component redirects
2. Editor Component
- ✅
libs/editor-web-lib/src/lib/components/editor-workspace/editor-workspace.component.ts- Added reactive context detection (
contextcomputed signal) - Reads all route params:
moduleId,universeId,pageId,componentId,worldId - Handles legacy routes with automatic redirects
- Dynamic title based on context
- Added reactive context detection (
3. Navigation Updates
Modularity:
- ✅
libs/modularity-lib/src/lib/components/page-selector/page-selector.component.ts- Updated
goToEditor()to use new route format - If
moduleId→/space/{space}/editor/module/{moduleId} - If no
moduleId→/space/{space}/editor
- Updated
Space Map:
- ✅
libs/space-map-lib/src/lib/components/universe-detail/universe-detail.component.ts- Updated
openEditor()to use SpaceNavigationService - Navigates to blank canvas:
/space/{space}/editor
- Updated
Core Services:
✅
libs/core-angular/src/lib/services/unified-navigation.service.ts- Updated all editor navigation to use new format
- Uses SpaceNavigationService for space-aware routing
- Format:
editor/universe/{universeId}/page/{pageId}
✅
libs/core-angular/src/lib/components/page-selector-modal/page-selector-modal.component.ts- Updated page selection navigation
- Uses SpaceNavigationService
Landing Page:
- ✅
libs/editor-web-lib/src/lib/components/landing-editor/landing-editor.component.ts- Updated all navigation calls to use SpaceNavigationService
- All routes now space-aware
Manifest:
- ⚠️
libs/editor-web-lib/src/lib/editor.manifest.ts- Updated route format with TODO
- Needs refactoring to accept SpaceNavigationService or spaceSlug
🔄 Context Detection
The EditorWorkspaceComponent now detects context reactively:
readonly context = computed(() => {
if (moduleId()) return 'module-builder';
if (componentId()) return 'component-builder';
if (pageId() && universeId()) return 'edit-universe-page';
if (pageId() && worldId()) return 'edit-world-page';
if (pageId()) return 'edit-page';
return 'blank-canvas';
});
🔄 Legacy Route Handling
Old routes automatically redirect:
/space/{space}/editor/{universeId}/workspace→ Redirects to/space/{space}/editor/universe/{universeId}/page/{pageId}(if pageId exists) → Or/space/{space}/editor(blank canvas)
⚠️ Known Issues / TODOs
Editor Manifest Action (
editor.manifest.ts)openPageaction needs spaceSlug for proper routing- Should be refactored to accept SpaceNavigationService or spaceSlug parameter
- Currently uses placeholder
temp-space(needs fix)
Future Enhancements:
- Add "Return to Module Builder" button when in
module-buildercontext - Tag pages with
moduleIdmetadata when created in module context - Auto-refresh page list in Modularity when returning from Editor
- Add "Return to Module Builder" button when in
✅ Testing Checklist
- Navigate from Modularity → "Create Pages" → Should go to
/editor/module/{moduleId} - Navigate from Space Map → "Open Editor" → Should go to
/editor(blank canvas) - Navigate to existing page → Should go to
/editor/universe/{universeId}/page/{pageId} - Legacy routes → Should auto-redirect to new format
- Context detection → Component should show correct title/UI based on route
🎉 Result
The Editor is now a universal content creation tool that adapts to any context through clean routes. No more confusion between module-building and universe-editing!