StyleManager AppendTo not showing in custom div
I verified it is since v0.17.25 v0.17.22 >>> working v0.17.25 >>> not working
Read full answer below βQuestion
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome 93
Reproducible demo link
https://codepen.io/paooolino/pen/WNOPgJy
Describe the bug
How to reproduce the bug? This is quite simple because I was using Grapes v.0.16.xx and it worked until I upgraded to the latest release and my StyleManager panel disappeared. I can provide a codepen with previous version (working) https://codepen.io/paooolino/pen/jOwdvZv
and then another one with identical code but upgraded library (not working) https://codepen.io/paooolino/pen/WNOPgJy
The code is quite simple because I just need to show the styleManager in a custom div with some sectors defined.
I looked for similar issues but I didnt found my case. I also tried with appendTo: '#panels' either with dom element as in the codepens.
What is the expected behavior? The styleManager should be shown in the defined #panels div.
What is the current behavior? The styleManager does not shows.
Maybe I missed something? Thankyou for your attention.
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
I verified it is since v0.17.25
v0.17.22 >>> working v0.17.25 >>> not working
Thanks Paolo, that will be fixed in the next release. The problem is with the default StyleManager opener command, which moves the rendered part, from your container, to the default one. You can verify that by disabling the default button which activates the command (which moves the element once pressed).
editor.Panels.getButton('views', 'open-sm').set('active', false);
So, as a workaround, you should delete it or hide it with CSS
editor.Panels.removeButton('views', 'open-sm');
thankyou for the release. And sorry for reopening :-) but now the StyleManager appendTo is working, while the blockManager appendTo appears to be broken. Same problem with the previous StyleManager. I verified it was working in previous v.0.17.26 but now v.0.17.27 is not showing. πJust tell me if you need a codepen.
Thanks for reporting this, @paooolino.
Great question about StyleManager AppendTo not showing in custom div. The recommended approach with StyleManager 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 #6549
Couldnt Resize image
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://code...
Issue #6318
Unable to use transparent fill in Block media svg
GrapesJS version[X] I confirm to use the latest version of [email protected] when this issue was filedWhat browser are you using? Fir...
Issue #6685
Custom component styles are not applied after deletion and re-addition
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v143.0.7499.193 Reproducible demo l...
Issue #4572
Page update event doesn't fire
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome Reproducible demo link https://jsfi...
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
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins β TinyMCE Inline Text Editor and Placeholder.
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.