Skip to content

Add Advanced WYSIWYG Builder with AI collaboration#60

Merged
davis9001 merged 42 commits into
mainfrom
copilot/add-advanced-wysiwyg-editor
Jan 24, 2026
Merged

Add Advanced WYSIWYG Builder with AI collaboration#60
davis9001 merged 42 commits into
mainfrom
copilot/add-advanced-wysiwyg-editor

Conversation

Copilot AI commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

Implements a full-screen visual page builder to replace the basic WYSIWYG editor. Users can compose pages using drag-and-drop components, with live preview, device-specific rendering, and AI assistance.

Implementation

Core Architecture

  • Route: /admin/builder/[[pageId]] - Full-screen layout bypassing admin chrome
  • State: Immutable history with 50-step undo/redo, auto-save every 30s
  • Components: 6 new Svelte components (~1,300 LOC)
    • AdvancedBuilder: Main orchestrator with keyboard shortcuts (Ctrl+Z/Y/S)
    • BuilderToolbar: Device preview (mobile/tablet/desktop), save status, AI toggle
    • BuilderCanvas: Live preview with widget manipulation controls
    • BuilderSidebar: Component library (10 widgets) + layers panel with search/filtering
    • BuilderPropertiesPanel: Wrapper for existing WidgetPropertiesPanel
    • BuilderAIPanel: Chat interface for AI-assisted editing

Integration Points

  • Reuses existing WidgetRenderer for component preview
  • Leverages existing page/widget/revision APIs from src/lib/server/db/
  • Parses DBPageWidget (config as JSON string) to PageWidget (config as object)

Widget Operations

// Add widget from library
const newWidget: PageWidget = {
  id: `temp-${Date.now()}`,
  type: 'hero',
  config: { heading: 'Welcome', heroHeight: { desktop: '400px' } },
  position: widgets.length
};

// History tracked automatically
addToHistory(); // Captures { title, slug, widgets } snapshot

Screenshots

Empty canvas with component library:
Initial View

Hero component added with controls visible:
With Component

Current Scope

Phase 2 Complete:

  • Full-screen builder interface at /admin/builder
  • Component library with 10 widget types (Hero, Columns, Spacer, Divider, Heading, Text, Button, Image, Product, Product Grid)
  • Live canvas with widget selection/manipulation
  • Undo/Redo with change tracking
  • Device preview switcher
  • AI panel UI (backend integration pending)
  • Auto-save and unsaved changes indicator

🚧 Future Phases:

  • Drag-and-drop from library to canvas
  • Unlimited nesting with drop zones
  • Expand component library (50+ widgets)
  • AI backend integration for natural language editing
  • Visual revision diff
  • Breakpoint-specific style overrides
  • Symbol/component library for reusables

Technical Notes

  • Type Safety: Added type cast for DBPageWidget[]PageWidget[] transformation in page load
  • Multi-tenant: Uses locals.siteId directly (not tenantContext)
  • API Compatibility: getPageRevisions() requires 3 args: (db, siteId, pageId)
  • Widget Types: Added missing types (features, pricing, cta) to default configs for WidgetType completeness

All 1,249 tests passing. Type checking clean except 2 expected warnings for unused exports (revisions, isNewPage - reserved for future phases).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sparrow.cloudflare.com
    • Triggering command: /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hermes/hermes/node_modules/wrangler/wrangler-dist/cli.js d1 migrations apply hermes-db --local (dns block)
    • Triggering command: /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hermes/hermes/node_modules/wrangler/wrangler-dist/cli.js d1 execute hermes-db --local --file=/home/REDACTED/work/hermes/hermes/scripts/seed-data.sql (dns block)
  • workers.cloudflare.com
    • Triggering command: node /home/REDACTED/work/hermes/hermes/node_modules/.bin/vite dev --host 0.0.0.0 (dns block)
    • Triggering command: /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hermes/hermes/node_modules/wrangler/wrangler-dist/cli.js d1 migrations apply hermes-db --local (dns block)
    • Triggering command: /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hermes/hermes/node_modules/wrangler/wrangler-dist/cli.js d1 execute hermes-db --local --file=/home/REDACTED/work/hermes/hermes/scripts/seed-data.sql (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Robust and usable WYSIWYG with AI collaborative editing</issue_title>
<issue_description>As a store admin (technical or non-technical), I want an extremely powerful, mobile-first, full-screen Advanced Page & Component WYSIWYG editor with unlimited nesting, live preview, and AI assistance, so that I can visually compose any page type (homepage, landing pages, collection pages, product pages overrides, blog posts, email templates, popups, etc.) using intuitive drag-and-drop, deeply nested sections, reusable components, and beautiful defaults — while retaining limitless customization of layout, styling, animations, logic, and functionality — all without writing code, yet allowing power users to drop in custom CSS/JS/HTML when desired.

Background & Vision

Hermes already has basic Page CRUD with revisions and a simple WYSIWYG. This new editor replaces and dramatically expands that system into a world-class, Framer/Webflow/Builder.io-level visual builder that feels magical on both desktop and mobile. The goal is zero-learning-curve for 90% of use cases (drag beautiful pre-built sections, tweak text/images, done) while giving power users unlimited depth (nested responsive grids, custom animations, conditional visibility, dynamic data binding, custom code components, etc.).

Scope for this Issue

  1. Add new top-level route /admin/builder/:pageId? — full-screen, distraction-free, mobile-first builder canvas.
  2. Add sidebar item Builder
  3. Split-screen or adaptive layout:
    • Mobile (<768px): Canvas only, bottom toolbar, tap-to-edit.
    • Desktop: Left = layers/tree view + component library, Center = live canvas with device previews, Right = contextual properties panel.
  4. Core editing paradigms:
    • Select → edit inline (text, images) or in right panel.
    • Drag-and-drop from component library into canvas or between existing containers.
    • Unlimited nesting: A page should be able to include another page and a component should be able to include another component.
    • Hover outlines + breadcrumbs for deep nesting.
  5. Built-in component library with 60+ beautiful, production-ready components out of the box (Hero, Navbar, Footer, Product Grid, Testimonials, Image Gallery, Countdown Timer, Forms, etc.) — all fully responsive and theme-aware.
  6. Global Styles & Theme editor (colors, typography, shadows, border radius, etc.) with live preview.
  7. Reusable "Symbols" / Saved Components (create once, sync everywhere, override per-instance).
  8. Revision history with visual diff and one-click revert.
  9. Device-specific previews & editing (Desktop, Tablet, Mobile) with breakpoint-specific overrides.
  10. Settings panel for adding AI provider API keys (OpenAI, Anthropic, Grok, etc.).
  11. Export/import pages as JSON for backups or templates marketplace (future).

Acceptance Criteria

  • New "Builder" sidebar item opens full-screen /admin/builder.
  • Canvas shows real-time live preview of the actual storefront page (SSR via iframe or headless render).
  • Drag-and-drop component insertion with drop zones that intelligently appear inside nested containers.
  • Unlimited nesting depth with performant rendering (virtualized tree).
  • Inline editing for text, images, buttons, etc. (double-click or tap).
  • Right panel shows contextual properties (padding, background, border, typography, animations, visibility rules, etc.).
  • Responsive breakpoints (Desktop ≥1200px, Tablet 768-1199px, Mobile <768px) with per-breakpoint overrides.
  • Global theme editor affecting all components instantly.
  • Create, edit, and instance-link "Symbols" (saved reusable components).
  • AI chat panel inside builder:
    • Natural language commands modify the page in real time.
    • Multimodal: drop images → "Build a hero section using these photos".
    • Streaming responses with "Apply" button for changes.
  • Revision history panel with thumbnail + visual diff (highlight added/removed/moved elements).
  • Mobile experience feels native: bottom floating toolbar (+ Add, Layers, Preview, Undo/Redo, Save), keyboard-aware, pinch-to-zoom canvas.
  • All changes saved as drafts automatically; explicit "Publish" button pushes to live.
  • Custom CSS/JS panel per page and per component (power-user escape hatch).
  • Dynamic data binding (e.g., {{product.title}}, {{collection.products}}, loops, conditionals) via visual picker + fallback to Handlebars-like syntax.
  • Performance: <100ms interaction latency even with 200+ nested elements.
  • Accessibility: All generated markup follows WCAG AA by default.

Technical Notes

  • Stack: SvelteKit + Konva.js or React-Grid-Layout alternative → pure Svelte with custom canvas using absolute positioning + Tailwind.
  • Storage: Pages stored as JSON AST in D1 + full HTML snapshot for revisions.
  • Rendering engine: Recursive Svelte component resolver from JSON AST (same ...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2025

Copy link
Copy Markdown

Deploying hermes with  Cloudflare Pages  Cloudflare Pages

Latest commit: cac8319
Status:🚫  Build failed.

View logs

Copilot AI changed the title [WIP] Add robust WYSIWYG editor with AI collaboration Add Advanced WYSIWYG Builder with AI collaboration Nov 20, 2025
Copilot AI requested a review from davis9001 November 20, 2025 06:16
- Added `normalizeWidgetPositions`, `needsPositionNormalization`, and `stableSortWidgets` functions to ensure unique and sequential widget positions.
- Updated various routes to utilize the new widget normalization logic, including the builder and page server routes.
- Refactored widget fetching logic to retrieve widgets from published revisions instead of the database directly.
- Changed admin page links to redirect to the new builder interface.
- Implemented redirection for old page editing and creation routes to the new builder.
- Enhanced error handling and logging for widget and page operations.
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://f6d6fa5e.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 591eb40

Preview will be available shortly after deployment completes.

- Implemented server-side logic for creating and managing layouts in the admin panel.
- Added a new page for creating layouts with form validation and slug generation.
- Created API endpoints for components, including creation, updating, and deletion.
- Enhanced layout management with the ability to associate widgets with layouts.
- Introduced a comprehensive CSS file for consistent styling across browser elements.
- Updated page API to support layout association for better content management.
…state

- Added `widgetChanges.ts` with functions to apply widget changes (add, remove, update, reorder).
- Introduced `WidgetChange` interface to define the structure of widget change actions.
- Enhanced widget management in the admin builder by loading both published and latest draft revisions.
- Updated the admin components page to improve UI and user experience, including better handling of component actions.
- Refactored the pages management to utilize a new `DataTable` component for better data presentation.
- Added context detection for AI chat interactions to enhance user experience based on conversation history and URL context.
- Created a new API endpoint for detecting AI context from conversation history and URL.
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://2011046c.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 9ba9991

Preview will be available shortly after deployment completes.

- Added 'component_ref' widget type to support component references.
- Introduced ComponentWidget and ComponentWithWidgets interfaces for better structure.
- Updated getWidgetDisplayLabel function to handle component references and return appropriate labels.
- Modified component loading logic to include widgets when fetching components.
- Enhanced component creation and update endpoints to handle widget data.
- Implemented new API endpoint to retrieve widgets for a specific component.
- Improved component management UI to categorize built-in and custom components.
- Added cloning and resetting functionality for built-in components.
- Updated page server and client routes to replace 'widgets' with 'components'.
- Refactored component imports in Svelte files to align with new component structure.
- Modified database interactions to handle components instead of widgets.
- Adjusted API endpoints for creating, updating, and retrieving components.
- Implemented new component management logic in the builder and layout sections.
- Ensured backward compatibility where necessary and updated related types.
- Implement tests for ChildLayoutEditor component covering rendering, flex controls, grid controls, order control, responsive values, and quick presets.
- Create tests for component database functions including getComponents, getComponentsByType, getComponent, and createComponent.
- Enhance component handling by adding is_primitive flag to component structure and ensuring proper parsing of component configurations.
- Update component creation logic to include is_primitive flag and ensure correct handling of primitive and non-primitive components.
- Introduce circular reference validation when adding component references to prevent dependency issues.
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://45a62682.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 45a8675

Preview will be available shortly after deployment completes.

…ructure, routing, data loading, and advanced features
@github-actions

github-actions Bot commented Dec 7, 2025

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://b6a7eb20.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 43150a0

Preview will be available shortly after deployment completes.

- Implement responsive CSS custom properties for container components in FrontendComponentRenderer.svelte, allowing for dynamic styling based on breakpoints.
- Add a new function to generate responsive styles and apply them in the component's style attributes.
- Introduce a page-level override for showing the page title in PageWithLayout.svelte, allowing individual pages to control title visibility.
- Update ComponentPropertiesPanel.svelte to include a toggle for the page title display setting for yield components.
- Modify BuilderPropertiesPanel.svelte to allow overriding the layout's default title display setting for pages.
- Adjust Pricing.svelte to utilize responsive styles for layout and padding, improving the overall design on different screen sizes.
- Update types in pages.ts to reflect new properties for page title display settings.
- Ensure proper data flow for page properties in the server-side load function and client-side page component.
…w commands, and update database reset/seed scripts
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://66bb1fc9.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 6c0362f

Preview will be available shortly after deployment completes.

…rt in ContainerDropZone

- Updated BuilderToolbar to support mobile view with a hamburger menu and responsive layout adjustments.
- Added functionality to toggle mobile menu and display title in a mobile-friendly format.
- Implemented touch drag-and-drop functionality in ContainerDropZone for better mobile usability.
- Introduced new utility functions to extract content previews from various component types in componentDefaults.
- Enhanced unit tests to cover new content preview extraction logic and mobile drag-and-drop interactions.
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://c695b979.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: b926a78

Preview will be available shortly after deployment completes.

- Implement touch drag-and-drop for components in the AdvancedBuilder and BuilderCanvas.
- Add a cancel zone for touch drag operations to allow users to cancel adding components.
- Update BuilderLeftPanel to maintain sidebar visibility during dragging.
- Improve touch drag ghost appearance and behavior for better user experience.
- Refactor touch event handling in BuilderSidebar for better compatibility and performance.
- Introduce visual indicators for drop zones during touch dragging.
- Implemented UserThemePreferences component for managing user theme settings.
- Created API endpoints for getting and saving user theme preferences.
- Added tests for user theme preferences functionality.
- Updated built-in components (Button, Footer, NavBar) to support theme customization.
- Enhanced layout and page components to integrate theme preferences.
- Included theme toggle in navbar configuration.
- Improved FOUC prevention during hydration in layout.
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://36488b1f.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: 3e46eb7

Preview will be available shortly after deployment completes.

@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Environment: Preview
URL: https://28290122.hermes-1dh.pages.dev
Branch: copilot/add-advanced-wysiwyg-editor
Commit: c198c51

Preview will be available shortly after deployment completes.

@davis9001 davis9001 marked this pull request as ready for review January 24, 2026 15:24
@davis9001 davis9001 merged commit 98b78fb into main Jan 24, 2026
3 of 4 checks passed
@davis9001 davis9001 deleted the copilot/add-advanced-wysiwyg-editor branch January 24, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Robust and usable WYSIWYG with AI collaborative editing

2 participants