How to refresh Classes view for active Component in the Style Manager
Ah. The ClassTagsView (classes section of the style manager) updates the selector list on the event "change:selectedComponent" on the editor model. https://github.com/artf/grapesjs/blob/66c19dae4ff5536a34b9ea73d3614fc76752a77c/src/selector_manager/view/ClassTagsView.js#L54 Fixed my problem by adding the following to t...
Read full answer below ↓Question
I'm using a trait (type=select) to change the class of a component (a "column" component, so classes representing width 1-12). After I have removed previous col-* classes and added the newly selected one (via a function triggered by the select change), the Classes section of the Style Manager still has the old class. If I select a different component, then select the column again, it has the new, correct class. How do I force a refresh on the style manager without de/reselecting the component? Perhaps I am adding/removing classes incorrectly, if the Style Manager view should update automatica...
Answers (2)
Ah. The ClassTagsView (classes section of the style manager) updates the selector list on the event "change:selectedComponent" on the editor model. https://github.com/artf/grapesjs/blob/66c19dae4ff5536a34b9ea73d3614fc76752a77c/src/selector_manager/view/ClassTagsView.js#L54 Fixed my problem by addin...
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #661
Class attribute not removed
Hello ! I noticed a problem with style manager when we add/remove classes. When we remove all classes it doesn't remove then from the gener...
Issue #1821
[QUESTIONS] How to apply the style changes to the ID instead of the class?
Hi, I have two elements with the same classes. I want to apply style changes with style manager to one of these two elements. I add ID but...
Issue #413
Use trait to modify component class
Hi! I'm trying to change the value of the classes with very little succes. Here is my custom trait's onValueChange function: Which results...
Issue #639
Re-render Component on Canvas when tagName has changed
I'm trying to build a basic Header component that lets you select H1 to H6 with a trait. But when an option is selected, the canvas doesn't...
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.