e1d381dc8a161b6262425a0001dbd8cd7311c198
Two bugs in TopBar's Preview handler: 1. exportToHtml() was called without a headCode option, so Preview silently ignored SiteDesign.headCode (custom <head> code the user set via the Code modal). Pull `design.headCode` from useSiteDesign() and pass it through, matching exportToHtml's ExportOptions.headCode signature. 2. html.replace(bodyMatch[1], composedBody) used the string-replacer overload of String.prototype.replace, which treats `$&`, `$1`, `$$`, etc. in the replacement string as special patterns -- any user content containing a literal `$` sequence would corrupt the preview HTML. Switch to a function replacer (`.replace(bodyMatch[1], () => composedBody)`) so the composed body is inserted literally. Verified by reading + `npm run build`; no existing TopBar test harness to extend (dynamic import + window.open/Blob in the click handler). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
Visual drag-and-drop website builder using GrapesJS
Languages
TypeScript
61.2%
HTML
17.1%
JavaScript
17%
CSS
3.6%
PHP
0.8%
Other
0.3%