grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

how to load a remote url inside grapes js

Open raghuv9 opened this issue 7 years ago • 1 comments

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('

New component
'); this.editor.load=(res => console.log('Load callback')); }, }

raghuv9 avatar Sep 12 '19 08:09 raghuv9

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>).

jcarizza avatar Sep 12 '19 16:09 jcarizza