feat: add HTML import and export for layers#146
Merged
tristan-mouchet merged 5 commits intodevelopfrom Apr 10, 2026
Merged
Conversation
- Add context menu options to import HTML into a layer and export a layer as HTML with syntax-highlighted code editor modals - Convert HTML elements to Ycode layer trees with proper TipTap rich text structure, design properties, and layer settings - Export layers back to HTML preserving rich text marks (bold, italic, links) and resolving Ycode layer names to standard HTML tags - Normalize Tailwind v3 classes to v4 on import: opacity modifiers, scale-shifted utilities, gradient renames, placeholder variants, and standalone utility removal - Convert inline CSS styles to Tailwind classes during import - Resolve named Tailwind color classes (bg-blue-600) to hex arbitrary values (bg-[#2563eb]) for compatibility with Ycode design system Made-with: Cursor
- Add span to INLINE_TEXT_TAGS to prevent nested <p> in rendered output - Extract shared escapeHtml, tailwind-colors, and tailwind-normalizer - Fix br incorrectly mapped to hr; skip br at block level - Add textarea/select/form attribute capture on import and export - Add overflow class parsing to classesToDesign - Add background-image, flex-grow/shrink/basis, order to styleToClasses - Sanitize SVG on import by stripping script tags and on* attributes - Wrap htmlToLayers and handleImportHtml in try/catch error handling - Replace deprecated execCommand copy fallback with toast message - Widen makeTextLayer to accept string|object, remove inline duplicate Made-with: Cursor
…ve image/media handling
tristan-mouchet
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add bidirectional HTML ↔ Layer conversion so users can import external HTML
(with Tailwind class mapping) and export their layer trees back to clean HTML.
Changes
htmlToLayersparser andlayersToHtmlserializer inhtml-layer-converterImportHtmlDialogandExportHtmlDialogUI components with code editorSizingDesigninclassesToDesignon*attributesescapeHtml,tailwind-colors, andtailwind-normalizermodules<span>treated as block-level, causing nested<p>in rendered output<br>incorrectly mapped to<hr>execCommand('copy')fallback with toast instructionTest plan
<p>warning<span>inside<p>— inline text preserved, no nesting errors<textarea>,<select>,<form>— attributes round-trip on export<script>oronclick— malicious content strippedoverflow-hidden) map to design panel correctlyMade with Cursor