[Question]: Can the editor be instructed to ignore a class?
Question
Once the editor creates HTML/CSS we hand it off to another piece of code. That piece of code relies on classes using a predetermined class name to perform actions on the HTML. (switching out placeholders for actual data etc.) If this class is added to an element, once that element is clicked, it attempts to add styles to this class. Is it possible to tell the editor to ignore a class?
Answers (3)
You could place a listener on a new selector
editor.on('selector:add', selector => {
const name = selector.get('name');
if (someConditionForSelectors(name)) {
selector.set({
// Can't be seen by the style manager, therefore even by the user
private: true,
})
}
});
What do you mean "to ignore"? To ignore where? Being available in the style manager or something else?
Sorry, I was unclear there. When clicking an element/block and proceeding to styling the element, the class is chosen by default. Could this class be deselected by default and hidden from the Classes field?

Related Questions and Answers
Continue research with similar issue discussions.
Issue #2596
[QUESTION] Add html, css and js to Block Manager
[QUESTION] Hi! I'm retrieving dynamic html,css and js codes from the database. How can I create Blocks with this? Currently, this is my cod...
Issue #1608
[Question] Customize CSS class name
GrapesJs editor creates a unique class for element and adds CSS rules to it. For example, Now, is there any way to customize this behaviour...
Issue #1577
Inline CSS Comments break Code Manager
Apparently this is valid piece of html and css: <div style="color: red; / height 200px; /; font-weight: bold;"> (Hence the commented out he...
Issue #2378
[QUESTION] Modifying global CSS in style manager
We want to achieve the following:Mark our block HTML elements with some classes like:Add some styles that define CSS classes like:Using Gra...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.