Class selector set to active: false not working properly
I found solution. Selector:add is called only when new component is added, but selector settings for that component wont save. After page reload it wont be called to previously saved components so they will have default value (true). To fix this problem, call this after components has been loaded. editor.SelectorManag...
Read full answer below ↓Question
Hi i set: editor.on('selector:add', selector => selector.set({ active: false, }));
to NOT select class on element after click and editing css, it is working but after page refresh it is selecting element's classes again. Is there any way to fix it?
Answers (1)
I found solution. Selector:add is called only when new component is added, but selector settings for that component wont save. After page reload it wont be called to previously saved components so they will have default value (true). To fix this problem, call this after components has been loaded.
editor.SelectorManager.getAll().map(selector => { selector.set({ active: false }) })
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2120
CSS properties of body (#wrapper) not editable after editor.setComponents(html);
When I save my page in a database refresh, the html and css are set like so $.ajax({ url: "../feeder.php", type: 'POST', processData: false...
Issue #3627
[QUESTION]: I'm trying to duplicate the page, but the styles are not geting applied due to the Ids, changes to -2,-3 at the end.
This is what my function looks like. I am trying duplicate the page, the HTML part is fine but as css is applied through ids, when a new pa...
Issue #4529
When we resize an image with a class 'xyz', all the elements on the page with same class also gets resized because editor adds css to those classes.
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Version 104.0.5112.101 (Official Build) (arm...
Issue #3421
[QUESTION] How to remove class selector css rule
I'm using componentFirst set to true to let my users apply needed style to component they selected. Selecting a component which is applied...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.