-
Notifications
You must be signed in to change notification settings - Fork 504
Saving and Loading
Mosaico library, by default, will save the contents to the browser local storage and load it back from there. Being a javascript library it doesn't directly deal with saving and loading to a backend/to database.
Most "integrators" will probably have to save the data in a backend and be able to start mosaico with a previously saved content. This can be done with no changes to the mosaico library code, but requires some integration code.
First of all, like explained https://github.com/voidlabs/mosaico/wiki/Replacing-TinyMCE-or-CKEditor-with-Mosaico mosaico "save data" is currently composed by "2 objects" (metadata + content) than can be serialized to JSON. The output HTML is only an "export" and cannot be loaded back (just like when you save a webpage as PDF you can't bring back the webpage html from the PDF).
So, in order to save to your backend you have to write a backend endpoint that will receive the metadata+content structures and save them and then you will have to write a page to browse that saves and start mosaico with the old metadata+content.
We plan to refactor mosaico so to make this kind of integration simpler (e.g: join metadata and content in a single document instead of dealing with 2 objects) but some coding will be needed because only you know what you want to do in the backend.
This issue is currently the best reference to create the "client-side" plugin: https://github.com/voidlabs/mosaico/issues/73
You may also find useful informations here: https://github.com/voidlabs/mosaico/issues/18 https://github.com/voidlabs/mosaico/issues/50