Convert JSON to HTML server-side
Hello, For future questions or technical issues, which aren't bugs, GitHub's Discussions tab is the place to be. Don't forget to close this issue if it is resolved or write a new detailed message in Discussions -> Q&A category (and close this issue). Thank you for your understanding.
Read full answer below βQuestion
So first of all, thank you @artf for this amazing project. I have a question: Is it possible to easily convert the components-JSON to HTML on the server-side (in a Node.js environment)? If it is possible, can you give me a hint how to achieve this? On the client-side it's quite straightforward: I can get the components-JSON (JSON.stringify(editor.getComponents());) and save it to my database. Then I can reuse my components later (editor.setComponents();) and get the HTML (editor.getHtml();) to show it in the browser. In my case though, I have to do it on the server-side. Any help would be gre...
Answers (4)
Hello, For future questions or technical issues, which aren't bugs, GitHub's Discussions tab is the place to be. Don't forget to close this issue if it is resolved or write a new detailed message in Discussions -> Q&A category (and close this issue). Thank you for your understanding.
Yes, if you have any kind of interactive content, that probably wouldn't work. Fortunately that's not the case for my application.
Maybe you could install grapesjs server-side(similar to client-side) and use it for rendering, otherwise you'll have to reverse engineer the renderer. Another alternative would be to store the generated HTML in the database as well.
Thanks for reporting this, @AdamTorma. Great question about Convert JSON to HTML server-side. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most operations can be...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3287
Wrapper styling
First of all, congrats @artf for this amazing project π― I am currently working on a project and I wanted to ask if I can edit the wrapper...
Issue #3347
How can I get Uncompressed JS code for me to edit?
Hi, thank you for reviewing my problem. I want to use my own JSEditor to edit htmlγcss and js. 1γFirst, I use getHtml, getCss, getJs to dis...
Issue #3329
How should I receive custom trait modifications in the script?
Hi, @artf, this is a great framework, thank you very much. I am now using it to create components of the mobile BUI framework, and I ran in...
Issue #4447
Style manager does not accurately reflect inherited color
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? 103.0.5060.114 Reproducible demo link http...
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.