thanhtunguet / grapesjs-react

A React wrapper for GrapesJS library
https://thanhtunguet.github.io/grapesjs-react
194 stars 58 forks source link

Accessing the elements and styles and saving it to database / loading from database #21

Closed jvrjosephlouie closed 4 years ago

jvrjosephlouie commented 4 years ago

Hello, first of all i would like to thank you for creating grapesjs-react. I am just new to grapesjs.

Can I ask how to access the html elements and the style of it? I want to save it to the database. I can access it through localstorage and save it as a state. But i also want to load the whole object so that it can still be editable once it is saved from the database.

Thank you so much.

edit: so in the storemanager I used this config:

const storageManager = { id: 'gjs-', type: 'remote', autosave: true, autoload: true, stepsBeforeSave:1, urlStore: 'https://xxxxxx/v1/store/grapejs/1', urlLoad: 'https://xxxxxx/v1/load/grapejs/1', storeComponents: true, storeStyles: true, storeHtml: true, storeCss: true, };

when i view the heroku console, i can see it coming but there is no object inside. It says Status code: 204 No Content when i try to check it on the network tab. Hope you could help me on this. Thanks.

thanhtunguet commented 4 years ago

Did you check the CORS problem? In most of cases, the problem caused by the back-end server does not allow your front-end origin to access.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS