Storing to Drupal
Question
This is inside of a Plugin, I can confirm after init. That the editor is using the defined storage that I defined. Additionally, I can trigger editor.load() and editor.store() and see ajax calls go out if i crate them in the respective options. However, if I do not have load or store defined then I see no traffic in the network console.
` var storageManager = editor.StorageManager; var drupalStorage = storageManager.add('drupal', { type: 'remote', urlStore: '/js/grapesjs/save',
urlLoad: '/js/grapesjs/load',
autosave: true,
params: {
entity_type: drupalSettings.wembassy.siteBuilder.entity_type,
'bundle': drupalSettings.wembassy.siteBuilder.bundle,
'template': $('#gjs-pn-templates-a select').val(),
'default': 1,
'status': 1
},
load: function(keys) {
console.log('Loading', keys);
var res = {};
for (var i = 0, len = keys.length; i < len; i++){
var v = drupalSettings.wembassy.siteBuilder.template_data[keys[i]];
if(v) res[keys[i]] = v;
}
return res;
},
store: function(data){
var templateData = {
'entity_type': drupalSettings.wembassy.siteBuilder.entity_type,
'bundle': drupalSettings.wembassy.siteBuilder.bundle,
'template': $('#gjs-pn-templates-a select').val(),
'data': data,
'default': 1,
'status': 1,
};
$.ajax({
type: "POST",
url: "/js/grapesjs/save",
data: templateData,
async: false,
success: function(e) {
console.log("Saved data", e);
return true;
},
dataType: "json"
});
}});
storageManager.setCurrent('drupal');
`Answers (0)
No answers yet.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #849
Ability to unload and destroy the editor instance or reload the config options?
In my use case, I'm trying to change the store and load URLs used by the remote storage manager dynamically. As far as I can tell, the edit...
Issue #2073
[QUESTIONS] Trouble using urlLoad
I've got an issue calling to my endpoint to load a template, it's doing a pre flight OPTIONS request but I cant find how to continue after...
Issue #1985
[BUG] Autosave with remote storage doesn't send network requests
OS: Windows 10 Browser: Chrome 73 GrapesJS version: 0.14.57 I have remote storage configured using this call to grapesjs.init(): While I se...
Issue #1092
[BUG]traits and storage trigger
Hey, maybe it's not bug, i'm not sure. I have traits with changeProp: true field. When I change the value of trait by UI, model is changed...
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.