grapesjs
grapesjs copied to clipboard
Could some one please help me with Custom Load.
What I can use instead of followings-
editor.setHtml( arr_data['html'] ), editor.setCss( arr_data['css'] ),
In below code.
Below is my code:-
editor.Commands.add( 'load-command', {
run(editor, sender) {
editor.load(() => {
sender.set('active', 0);
});
var arr_html_data = {};
arr_html_data['nid'] = 65;
arr_html_data['content_type'] = "";
arr_html_data['op'] = "loadContent";
$.ajax({
url: DrupalBasePath + '/landing/joperation/1',
method: "POST",
data: JSON.stringify( {
'op' : "loadContent",
'request': arr_html_data,
} ),
dataType: "json"
}).done(function( data ) {
alert( "Data has been loaded successfully." );
var arr = $.map(data, function(el) { return el });
var arr_data = JSON.parse( arr[0]['data'] );
console.log( editor );
editor.setHtml( arr_data['html'] ),
editor.setCss( arr_data['css'] ),
// arr_data['assets'] = editor..getAll();
editor.setStyle( arr_data['style'] ),
editor.setComponents( arr_data['components'] );
});
},
},
);
What I can use insted of followings- editor.setHtml( arr_data['html'] ), editor.setCss( arr_data['css'] ),
Thanks in Advance.
Just don't use them for loading your template data
editor.setStyle( arr_data['style'] ),
editor.setComponents( arr_data['components'] );
is all what you need
Thank you....
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.