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.36k stars 4.05k forks source link

How to load grapesjs by default preview #6063

Closed sridharK64 closed 1 month ago

sridharK64 commented 1 month ago

GrapesJS version

What browser are you using?

latest

Reproducible demo link

https://stackblitz.com/edit/grapesjs-react-custom-ui-nrqcgn?file=src%2FApp.tsx

Describe the bug

How to reproduce the bug?

  1. ...
  2. ...

What is the expected behavior? ...

What is the current behavior? ...

If is necessary to execute some code in order to reproduce the bug, paste it here below:

// your code here

Code of Conduct

danstarns commented 1 month ago

Hi, @sridharK64 thank you for your report, can you elaborate on your issue, please? As we only have:

  1. 'How to load grapesjs by default preview'
  2. Your stack blitz

Could you tell us what you're trying to achieve?

artf commented 1 month ago

@sridharK64 I got what you mean but the next time try to elaborate a bit better.

To trigger the preview on load, this would be enough

editor.onReady(() => {
   editor.runCommand('core:preview')
});

but in your example, you're using @grapesjs/react with full custom UI, which means you have to implement your own implementation of how to handle the preview with your react components.