# Insertr Structural Refactoring - Work in Progress ## Current Status: Major Simplification Opportunity Identified We've identified that the current Insertr codebase has remnants from multiple refactoring phases and can be significantly simplified by fully embracing the HTML-first philosophy outlined in CLASSES.md. ## Key Insights Discovered ### 1. **Obsolete Content Type System** - **Problem**: Currently has 3 content types (`'text'`, `'html'`, `'structured'`) with complex routing logic - **HTML-First Reality**: Only need HTML preservation with automatic style detection - **Opportunity**: Remove `data-content-type` attributes entirely and detect behavior from HTML element tags ### 2. **Multiple Editor Systems (Legacy)** - **Current**: Complex strategy detection choosing between simple vs rich editors - **HTML-First**: Always use StyleAwareEditor with HTML preservation and remove legacy code - **Benefit**: Massive code reduction, consistent behavior everywhere ### 3. **Element-Based Behavior Detection** - **Instead of**: `data-content-type="link"` attributes - **Use**: Element tag analysis (`` = link behavior, `

` = text behavior) - **Source**: Behavior rules already defined in CLASSES.md ### 4. **UX Optimization Opportunity** - **Direct Multi-Property Editing**: `` should open URL+text editor immediately - **Rich Text Editing**: `

` with nested elements should use StyleAwareEditor - **Context-Appropriate UX**: Right editor for the right element type ## Planned Refactoring (Major Changes) Keep in mind that we need no legacy code preserved or backwards compatibility. Database changes can be done to the schema, not with ALTER statements. We have no data to preserve and no users of any current insertr versions. ### Phase 1: Frontend Simplification - [ ] **Remove content type routing** from StyleAwareEditor - [ ] **Eliminate 'text' and 'structured' handlers** - keep only HTML preservation - [ ] **Remove simple/textarea editor** that strips HTML formatting - [ ] **Implement element-based behavior detection** using tag names - [ ] **Create direct multi-property editors** for ``, `