Mj-preview is not editable
This is not core related issue and probably not an issue at all as <mj-preview> is not supported by default in mjml plugin
Read full answer below βQuestion
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Safari 17
Reproducible demo link
https://grapesjs.com/demo-mjml.html
Describe the bug
How to reproduce the bug?
- https://grapesjs.com/demo-mjml.html
- Go to view code - copy the MJML
- Go to import code - paste in the MJML and add to the top
<mj-head><mj-preview>Some preview text</mj-preview></mj-head> - Now try to edit it
What is the expected behavior?
Should be able to edit - or it shouldn't be visible in the editor.
What is the current behavior? It displays top left, with default font, no padding, and is not editable. In previous versions of grapeJS builder it is in fact editable, but if you edit it too short the highlight "BODY" gets in the way and you can never get back to editing it. Further, if you empty it, it seems unreachable in the editor completely but the gap is still there.
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
This is not core related issue and probably not an issue at all as <mj-preview> is not supported by default in mjml plugin
@artf Sorry I don't understand. Itβs an issue as detailed. Is it something to raise on the other repository? Iβm not familiar with the internals here so donβt know what it is that the GrapesJS/mjml needs to support in order for this repository to not display it
It is noted in Head: https://github.com/GrapesJS/mjml/blob/master/src/components/Head.ts#L14
Thanks for reporting this, @driskell.
Great question about mj-preview is not editable. The recommended approach with GrapesJS is to use the event-driven API.
Start here:
- Check the GrapesJS documentation for your specific module
- Look for the
on()event listener method - Most operations can be achieved by listening to editor and component events
Common patterns:
// Listen for changes
editor.on('change', () => console.log('something changed'));
// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));
If you're still stuck:
- Share a minimal CodeSandbox reproduction
- Include what you've already tried
- Mention your GrapesJS version
- The community is here to help!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6152
CSS added via custom code persists after custom code component is removed
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link https://grapesj...
Issue #4208
Style click state bug in every element
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Last, tested on chrome last and Safa...
Issue #6683
Modals close on mouseup event outside of modal rather than a full click
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 143.0.7499.169 Reproducible demo li...
Issue #6211
Too much recursion
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox 131.0.2 Reproducible demo link htt...
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 βRelated tutorials
In-depth guides on the same topic.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
Weβve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.