How to load a remote url inside grapes js
Hello @raghuv9 first think that you cant make a request with AJAX because the CORS. Ypu need to grab the content in other way (maybe in the backend) and renderize in the editor with. editor.component(<your-content>).
Read full answer below βQuestion
this is how i tried to load my gitpage but its not working
mounted() {
const LandingPage = {
html: '',
css: null,
components: null,
style: null,
};
this.editor = grapesjs.init({
container: "#gjs",
canvas: {
styles: [],
},
fromElement: true,
components:'' ,
style: '',
plugins: [],
pluginsOpts: {
"gjs-preset-webpage": {}
},
storageManager: {
type: 'remote',
stepsBeforeSave: 10,
urlStore: '',
urlLoad: '',
params:{
'Access-Control-Allow-Origin':'http://laravel-vue-spa.test',
},
contentTypeJson: true,
headers: {
'Content-Type': 'application/json'
},
json_encode:{
'gjs-components': [],
'gjs-style': [],
}
},
});
this.editor.setComponents('<div class="cls">New component</div>');
this.editor.load=(res => console.log('Load callback'));
},
}Answers (1)
Hello @raghuv9 first think that you cant make a request with AJAX because the CORS. Ypu need to grab the content in other way (maybe in the backend) and renderize in the editor with. editor.component(<your-content>).
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2265
able to fetch my local html file using load url and getting status ok how can i load this fetched url into editor currently im getting blank screen inside editor
here is my code const LandingPage = { html: '', css: null, components: null, style: null, }; this.editor = grapesjs.init({ container: "#gjs...
Issue #6202
Javascript CDN not working on grapejs canvas
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? 129 Reproducible demo link https://grapesj...
Issue #2416
Unable to display template from database to grapesjs
Able to fetch my remote HTML file using load URL and getting status ok, how can I load this fetched HTML AND CSS into editor? currently I'm...
Issue #966
[QUESTION] How to load external CSS file into Grapes Editor?
Hey, During my editor = grapesjs.init(), I want to load an external CSS file into the canvas using @import url(...). So when I use my custo...
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 βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.