<> is introduced at the beginning editor.getHtml()
I whittled the json down a quite a bit, and noticed there is some possibly invalid JSON being generated as output? Its like the introduction of the escaped double quotes is off slightly. JSON.stringify and JSON.parse don't seem to care about it, but theres something going on.
Read full answer below โQuestion
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome Version 121.0.6167.185 (Official Build) (64-bit)Reproducible demo link https://jsfiddle.net/ja50kzne/4/Describe the bug How to reproduce the bug?I had a webpage from a previous version of grapesJS that loads into grapes correctly. You can see this in the fiddle. The latest version of GrapesJS "created" the JSON seen in the fiddle. I did not manipulate it.Notice that grapesJS does load, no errors in the console. When performing editor.getHtml (for db storage), I see that there is an empty elem...
Answers (4)
I whittled the json down a quite a bit, and noticed there is some possibly invalid JSON being generated as output? Its like the introduction of the escaped double quotes is off slightly. JSON.stringify and JSON.parse don't seem to care about it, but theres something going on.
The root component of the page should be a wrapper, in your case is a textnode (eg. this might break a lot of stuff), with an empty tagName (the reason behind <>) and for some reason content: "undefined"(?) <img width="377" alt="Screenshot 2024-02-22 at 00 44 33" src="https://github.com/GrapesJS/gr...
This is what was coming out of Grapes 0.18.4, therefor it was generated by grapes. I would expect if content was "undefined", grapes would either strip it or ignore it. For now i'm just stripping the <> out on my end, but I thought I'd just share it with you.
The issue you're encountering with <> being prepended to your HTML output from editor.getHtml() is due to an invalid component definition in the JSON data you are loading into GrapesJS. Specifically, your components array contains an empty string "" as its first element. Root Cause: GrapesJS expect...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4094
When drag and drop block into editor in Chrome, not able to drag and drop block
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Version 97.0.4692.71 (Official Build) (64-...
Issue #4921
[X] I confirm to use the latest version of GrapesJS
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 110.0.5481.78 (Official Bui...
Issue #6116
AsDocument not working as expected
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 128 Reproducible demo link https://...
Issue #5442
After applying the text color not able to set the background color
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome Reproducible demo link https://jsfi...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins โPremium plugins ship with support, regular updates, and production-ready features โ save days of integration work.
Browse premium plugins โRelated tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins โ TinyMCE Inline Text Editor and Placeholder.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.