Issues with Loading new template after editor has initialized.
Question
I have a use case where I would like to allow users to switch the template they are editing.
On the initial load, the code seems to work fine and loads the template as expected, but on the subsequent loads the canvas is wiped blank.
load: function(keys, clb) {
var result = {},
fd = {},
params = {
'entity_type': drupalSettings.wembassy.siteBuilder.entity_type,
'bundle': drupalSettings.wembassy.siteBuilder.bundle,
'template': $('#gjs-pn-templates-a select').val(),
'default': 1,
'status': 1
};
for(var key in params)
fd[key] = params[key];
fd.keys = keys;
let req = $.ajax({
url: '/js/grapesjs/load',
data: fd,
async: false,
method: 'GET',
}).done(function(d) {
var result = {};
for (var i = 0, len = keys.length; i < len; i++){
var v = d.data[keys[i]];
if(v) result[keys[i]] = v;
}
console.log(result);
clb(result);
return result;
});
},
Answers (0)
No answers yet.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1651
How create a new modal dialog like the icons one?
Hi ! I would like create a new modal that contains templates for what users can use them later and add them to canvas/editor. I would like...
Issue #1863
Adding new components to Block Manager
I'm trying to add multiple components which are in my canvas into the block manager but I believe because of an id issue they're not visibl...
Issue #471
Third-party library styles collision
Hi, I would like to include a third-party styles and javascript in the editor. They are being added like this: The issue I'm experiencing w...
Issue #700
Undomanager and ctrl+z/ctrl+y
we load content from db once editor page load and if use select undo after any changes it makes editor canvas blank. Is there way to solve...
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.