Could some one please help me with Custom Load.
Below is my code:- What I can use insted of followings- editor.setHtml( arrdata['html'] ), editor.setCss( arrdata['css'] ), Thanks in Advance.
Read full answer below ↓Question
What I can use instead of followings-
editor.setHtml( arr_data['html'] ), editor.setCss( arr_data['css'] ),
In below code.
Answers (3)
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....
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1008
Convert local storage into sessionStorage
Thanks in advance! I want to use browser's sessionStorage instead of localStorage. Could some one please help me with this.
Issue #1836
How to add !important in all the generated apis
Hello @artf, While i am going to edit some html from editor with the help of css then i need to add !important into all the css which is ch...
Issue #1822
[QUESTION] - Add style sector for specific Css rule
Hey @artf , COuld you give your help on this one? I want to disable the user to able to select the wrapper block (body) but I still want to...
Issue #513
Model and returned html issue
I have below code to create custom component and wants to retrieve updated html via editor.html() but return wrong html, I am sure I am mis...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.