BUG: Incompatibility with grape js headless mode
- Dominant language
- TypeScript
- Stars
- 716
- Forks
- 251
- PR merge metrics
- No merged PRs in 30d
Description
### GrapesJS version
- [x] I confirm to use the latest version of GrapesJS
### GrapesJS MJML version
- [x] I confirm to use the latest version of GrapesJS MJML
### What browser are you using?
Not applicable (it's running on a server)
### Reproducible demo link
https://codesandbox.io/p/sandbox/m86rgn
### Describe the bug
**How to reproduce the bug?**
1. Init GrapeJS in headless mode
2. Try to run command mjml-code-to-html
**What is the expected behavior?**
The html is created (and does not rely on window since we run it in headless mode).
**What is the current behavior?**
We have this error :
```
window is not defined
ReferenceError: window is not defined
at Object.moduleId [as 480] ...
```
If is necessary to execute some code in order to reproduce the bug, paste it here below:
```js
const editor = grapesjs.init({
telemetry: false,
headless: true,
plugins: [usePlugin(grapesJSMJML, { useCustomTheme: false })],
projectData: {"test": "test"} as ObjectAny,
});
console.log(emailEditor.runCommand('mjml-code-to-html').html.toString());
```
### Workaround:
We found a solution by importing global-jsdom/register, that gives a mock of window.
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.