GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.38k stars 4.05k forks source link

Stored components with script can not be rendered properly #3713

Closed shkhalid closed 3 years ago

shkhalid commented 3 years ago

I am facing some problem when try to save some components which includes some scripts and reload the page the components are not rendered properly. It's showing empty boxes. Example: When i try to save a chart component from jvas28/grapesjs-echarts and reload the page i am getting this

Screen Shot 2021-08-18 at 4 20 43 PM

Here is the example app https://codesandbox.io/s/cranky-wescoff-93pxd?file=/src/App.js

storageManager: {
      autoSave: 1,
      autoload: 1,
      type: "local"
    }

I also tried to setup remote storage. But I get the same result. Here is the api output.

Screen Shot 2021-08-18 at 4 35 53 PM

I think this is related to https://github.com/artf/grapesjs/issues/1487 https://github.com/artf/grapesjs/issues/2069 https://github.com/artf/grapesjs/issues/3535 https://github.com/artf/grapesjs/issues/3141

artf commented 3 years ago

Hey @shkhalid thanks for the report, but on this repository, you should open reproducible issues without external plugins as it might be an issue with the plugin itself. At least for what I can tell about the core, I see no issues in Components with JS (if correctly implemented by following this guide)

shkhalid commented 3 years ago

Thanks @artf! Finally i was able to figure it out The problems was in tagVarStart and tagVarEnd. After commenting it out it starts working

return grapesjs.init({
    // tagVarStart: '{{ ',
    // tagVarEnd: ' }}',
    .
    .
    });