Load from Database
I've got an issue with loading the lory-slider from my mysql db. When i load it back in, the functionality is gone, i cant slide left or right. here is my save code: ` var cmdm = editor.Commands; cmdm.add('save-db', { run: function (em, sender) {
sender.set('active', true);
//get full HTML structure after design
//var InnerHtml = this.frameEl.contentDocument.activeElement.innerHTML;
var InnerHtml = editor.getHtml();
var css = editor.getCss();
console.log(editor);
//set post to save all HTML structure after design to DB
$.post("savetoDB.asp", { html: InnerHtml, css: css }, function (result) {
console.log("Saved to db");
sender.set('active', false);
}).fail(function(fail){
console.log(fail.responseText);
sender.set('active', false);
}); }});
and load which is converted from string to JSON format, im using asp classic so thats why its looking a bit weird:
response.write "{""gjs-css"":""" & css &""", ""gjs-html"":"""&""& html&""&"""}"
What i can see is that the data-gjs-type is sat to default on load, where as a new slider have data-gjs-type = "lory-slider"
@artf Im stuck could you maybe help me out?
You don't need that custom command, use the built-in remote storage, just storing HTML is not enough https://grapesjs.com/docs/modules/Storage.html
Thanks i solved it.
@Skovmissen How did you solve this problem, by using remote storage or by another way?
@ahmedeIdeeb25 Yes i ended up using the remote storage, i cant link my code because i dont have access to the project anymore due to new job.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.