Get change in property float
You can use the "model" passed as a parameter to get the current property. After inspecting the model object I figured out we can get the style using model.attributes.style You should get the desired output by modifying your code snippet in the following way: editor.on('component:styleUpdate:float', (model) => { conso...
Read full answer below βQuestion
I'm trying to listen to the change in the 'float' property whether it was shifted to the 'left' or 'right' or 'none' in Style Manager using an event but my code doesn't seem to give the desired result.
editor.on('component:styleUpdate:float', (model) =>
{ console.log('style update', editor.StyleManager.getProperty('General','float')); });
It gives style update null as the output. Desirable output would be float:right, float:left or float:none
Answers (3)
You can use the "model" passed as a parameter to get the current property. After inspecting the model object I figured out we can get the style using model.attributes.style You should get the desired output by modifying your code snippet in the following way: editor.on('component:styleUpdate:float'...
@sakshigarg9 The approach I mentioned above is not working for some of the components, to be more precise what I observed is that the style property is giving empty string on the components which have a class defined. Your approach of using editor is correct and also works for all the components, o...
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 #1971
event triggers previous state attributes to remote storage
I'm trying to extract the change in src of an image and store it in the remote storage using Storage Manager, by using the following code T...
Issue #1887
Get JSON of specific gjs-data-type
I want to export JSON of only a specific gjs-data-type="img" I'm trying this but it doesn't give any result:
Issue #701
Modifying a component in the editor clears the model content
What I'm trying to achieve: I have special "data-" attributes on some of the components I pull into the editor. When one of these is modifi...
Issue #714
Open Style Manager when selecting an element
trying to do this gives the error this.sender.get is not a function grapesjs.min.js toggleSm Basically I want to open the style manager whe...
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.