Commit Graph

11 Commits

Author SHA1 Message Date
e639c5e807 Implement client-side validation and sanitization
Add UX-focused validation to prevent user accidents and provide immediate feedback. Includes DOMPurify integration for basic content sanitization and real-time form validation.

Features:
- Real-time input validation with visual feedback
- Field-type specific validation (text, URL, markdown)
- DOMPurify integration for display sanitization
- Validation messages with auto-dismiss
- Prevents common user mistakes (HTML in text fields, invalid URLs)
- Client-side sanitization for markdown rendering
- Maintains security awareness while focusing on user experience

Note: This is UX-focused validation - server-side validation remains the primary security boundary.
2025-09-01 13:33:16 +02:00
39e60e0b3f Add hybrid editing system with markdown collections
Implement markdown collection support alongside existing element-level editing. Users can now choose between individual element editing (headlines, buttons) and rich markdown editing (stories, bios). Includes responsive overlay forms, smart field detection, and comprehensive documentation updates.

Features:
- Markdown collections with data-field-type="markdown"
- Responsive overlay forms that adapt to element width
- Element-level editing for granular control
- Updated documentation and integration guide
- Fixed marked.js renderer configuration issues
- Enhanced about.html to demonstrate both approaches
2025-09-01 13:20:29 +02:00
a13546aac2 Implement element-level editing with semantic field detection
Replace container-based blob editing approach with individual element editing. Each .insertr element now gets appropriate field type (text, textarea, link) based on HTML tag and classes. Provides much better UX with separate inputs for headlines, paragraphs, and buttons while preserving HTML structure and styling.
2025-08-30 17:01:25 +02:00
e8c0de233d Fix marked.js API integration for UMD build
🐛 Issue: marked is not a function error
 Fix: Properly access marked.js v16.x UMD API

🔧 Changes:
- Correctly access window.marked object from UMD build
- Find the parse function within the marked object
- Properly configure custom renderer with .use() method
- Add comprehensive error checking and logging

💡 UMD API Structure:
- UMD exposes: window.marked (object)
- Parse function: window.marked.marked or window.marked.parse
- Configuration: window.marked.use() method

Now ready to test the two-button scenario! 🎯
2025-08-30 12:40:33 +02:00
0d79ab1fef Replace custom markdown parser with marked.js v16.2.1
🚀 Major Upgrade: Professional markdown handling with marked.js

 Fixed Issues:
- No more recursion errors or browser crashes
- Proper handling of complex markdown (multiple links per line)
- Robust parsing of edge cases and nested formatting

🔧 Implementation:
- Added marked.js v16.2.1 via CDN to both HTML pages
- Custom renderer preserves button styling (btn-primary)
- Smart lead paragraph detection for styling preservation
- Intelligent element merging to maintain layout
- Removed all buggy custom parsing code (100+ lines)

🎯 New Capabilities:
- Multiple buttons per line: [Get Started](link1) [Or tomorrow](link2)
- Full CommonMark support (tables, lists, formatting)
- Better performance with optimized C-like parsing
- Extensible renderer system for future enhancements

 User Experience:
- Edit forms now handle complex markdown perfectly
- Layout and styling fully preserved after saves
- No more crashes when editing rich content
- Professional markdown processing

Ready to test the two-button hero scenario! 🚀
2025-08-30 12:37:45 +02:00
526c265e52 Fix infinite recursion in markdown parsing
🐛 Critical Fix: Maximum call stack exceeded error
 Solution: Properly handle regex match result in parseMarkdownToBlocks()

🔧 Issue:
- line.match(/^#+/)[0].length caused infinite recursion
- Browser crashed when editing rich content with headings

🔧 Fix:
- Store regex match result in variable first
- Add null check before accessing match result
- Prevents stack overflow when parsing markdown headings

 Now safe to edit content with # headings without crashes
2025-08-29 23:22:06 +02:00
dc70b74f7d Preserve layout and styling when applying edited content
🎯 Problem: Buttons and styling lost when saving rich content
 Solution: Smart content application that preserves HTML structure

🔧 New Features:
- parseMarkdownToBlocks() - Intelligently parses markdown
- updateRichContent() - Updates elements in place vs wholesale replacement
- canUpdateElement() - Checks element/content compatibility
- updateElementContent() - Preserves classes while updating content
- looksLikeButton() - Heuristics to detect and preserve button styling

🎨 Layout Preservation:
- Buttons keep their 'btn-primary' classes and styling
- Headings maintain existing CSS classes and hierarchy
- Paragraphs preserve lead/subtitle classes
- Links maintain href and visual styling

 User Experience:
- Edit 'Get Started Today' button → still looks like a button after save
- Rich content maintains professional appearance
- No more plain text where buttons should be

Smart frontend content management without backend complexity!
2025-08-29 23:08:46 +02:00
04e669eb95 Fix edit form content extraction - show clean customer view
🐛 Problem: Edit forms showed client view with edit buttons/emojis
 Solution: Extract clean content without edit interface elements

🔧 Changes:
- extractContentFromElement() now properly removes all edit UI
- Improved htmlToMarkdown() for better rich content conversion
- setupEditableElement() preserves original clean content
- Enhanced whitespace normalization in markdown conversion
- Handles both simple text and rich markdown content types

🎯 User Experience:
- Client sees: Content with edit buttons (✏️)
- Edit form shows: Clean, properly formatted content
- Customer sees: Original clean content (no edit UI)

 Whitespace improvements:
- Removes excessive indentation and spacing
- Normalizes line breaks and paragraph spacing
- Clean, readable content in edit forms

Critical fix for proper edit-in-place functionality
2025-08-29 23:04:29 +02:00
1a0a6b3254 Add development workflow and project setup
🛠️ Development Infrastructure:
- package.json with npm scripts for development
- live-server for hot reload during development
- Custom dev helper script with project validation
- Comprehensive .gitignore for Node.js and Go

📖 Documentation:
- Updated README.md with project overview and quick start
- DEVELOPMENT.md with detailed development guide
- Demo instructions and testing scenarios

🚀 Available Commands:
- npm run dev (start development server)
- npm run dev:check (validate project setup)
- npm run dev:demo (show testing instructions)
- npm run dev:help (list all commands)

 Features:
- Live reload on file changes
- Project health checking
- 18 editable elements detected
- 14.3KB core library size

Next: Ready for active development and testing!
2025-08-29 22:48:29 +02:00
af88e57272 Add working frontend prototype with edit-in-place functionality
 Features implemented:
- Complete demo website (Acme Consulting Services)
- Core insertr.js library with edit-in-place functionality
- Support for simple text and rich markdown content
- Mock authentication system (login/logout simulation)
- Edit mode toggle for client interface
- Local storage persistence
- Visual feedback for saving content
- Multi-page support (index.html, about.html)
- Responsive design with clean UI

🎯 Three user experiences:
- Customer: Clean website with no edit interface
- Client: Same website + edit buttons when authenticated
- Developer: Simple class-based integration

🏗️ Architecture:
- Vanilla JavaScript (no framework dependencies)
- Alpine.js ready for enhanced interactivity
- CSS-only styling for edit indicators
- Mock API structure for backend planning

Next: Connect to Go backend with real persistence
2025-08-29 22:41:15 +02:00
1f6279f79f Initial project setup with research and roadmap
- Research existing CMS solutions (TinaCMS, Strapi, Contentful, Ghost)
- Tech stack decision: Go + htmx/Alpine for edit-in-place functionality
- User experience design for three user types (Customer/Client/Developer)
- Prototype roadmap with three phases
- Authentication strategy with Authentik OAuth 2.0
- Core vision: Simple 'add a class and it works' integration
2025-08-29 22:37:32 +02:00