Grapesjs: GrapeJS for existing CMS

Created on 25 Feb 2020  路  5Comments  路  Source: artf/grapesjs

I am experimenting for a while with GrapeJS and already incorporated to our existing (custom) CMS, replacing tinyMCE.
Since the two approaches are different, i would like to ask for your assistance how to handle the page saving after finishing editing the content.
Right now, the approach is to extract contents of a standard defined area


..then post data in between and place it back (saving) to same file

What is your experience / approach, recommendation?
Meanwhile, i tried 'editor.destroy()' before saving the data, but could not make it work .. so far :)

Most helpful comment

@orionseye

editor.destroy() is not an option, since all the the html block declared with .init ..is gone as well.

you can call editor.getHtml and editor.getCss before destroying.
Cheers!

All 5 comments

@orionseye

..then post data in between and place it back (saving) to same file

if you are going for a custom approach, i suggest you see setup remote storage otherwise i do not understand what you mean by place it back!
and in case you mean the resulted html, you can always receive that by calling editor.getHtml() and editor.getCss(); no need to say you can do this regularly upon each save leveraging storage end callback.
Cheers!

@pouyamiralayi
Thank you for tip, i am considering to switch to remote storage, but for time being, the CMS was build to store (edited) content into flat file, the file someone currently edits.
Each page has its own index.php, so GrapeJS is active once the 'edit' button is clicked.
In that case, and after edit, the editor has to be destroyed, to save the template edits only.
That's what i meant.

editor.destroy() is not an option, since all the the html block declared with .init ..is gone as well.
I need a generic solution, to attach editor and then detach from the edited dom.
Can GrapeJS do this? Could'n find solution in the documentation

@orionseye

editor.destroy() is not an option, since all the the html block declared with .init ..is gone as well.

you can call editor.getHtml and editor.getCss before destroying.
Cheers!

That is beau.ti.ful !
3 lines and it works like a rocket.. get.Html even takes care to output valid html5
Sorry Pouya that i didn't think about that myself.
Thanks so much

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andre2 picture andre2  路  3Comments

alibouaziz picture alibouaziz  路  3Comments

tribulant picture tribulant  路  3Comments

nojacko picture nojacko  路  3Comments

kawika-connell picture kawika-connell  路  3Comments