Convert JSON to HTML server-side
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 greatly appreciated!
Answers (3)
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3639
[Feature]: Improve UndoManager API
One thing i think would add great functionality is a more detailed history stack. U can get the undo stack and build a sort of history repo...
Issue #1806
[Feature]: Add category on traits
Hi and thank's for your job ! It's possible to make traits under cateogories like blocks ? If it's possible, maybe use the Category object...
Issue #1759
[Feature request]: Typescript declarations
This is an amazing project! Thanks. Would it be possible to get typings for Typescript? It would make life a lot easier for the project I a...
Issue #2972
FEAT: Disable scripts on canvas
Hello, first of all thanks for a great tool. On my project i hit the problem where I need to disable scripts inside the editor. I found 2 s...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.