BUG: When I select an particular element I'm not getting its styles. This issue happens only with some elements.
Question
Not getting styles of the selected element
Here is my code, const model = editor.StyleManager.getModelToStyle(component); let styleObject = model.getStyle(); console.log("styles", styleObject)
Version:
0.14.49
Are you able to reproduce the bug from the demo?
[X] Yes [ ] No
What is the expected behavior?
When an element is selected I should get the styles of the selected element.
What is the current behavior?
When an element is selected I'm not getting any styles only empty object.
Are you able to attach screenshots, screencasts or a live demo?
[X] Yes (attach) [ ] No
Here's the screenshot of actual and expected result,
Actual

Expected

Answers (2)
First of all, you need to upgrade your grapesjs version (you're using a 2 years old one), then you have to provide a live demo of the issue.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1708
StyleManager events fire multiple times per change
To reproduce: On a fresh install of GrapesJS, within the demo page (within index.html), add an event listener like so: editor.on('component...
Issue #3389
MultiSelect some elements and change styles only work on the last selected element
Hi, when I MultiSelect some elements using shift, and change style in styleManager. Only the last clicked element will update the style. Ca...
Issue #3075
BUG: Unhandled Rejection (TypeError): i.classList is undefined
Hi. I updated GrapesJS to its current version 0.16.22 and I get an error on the callback function: editor.on("component:add", (model) => {...
Issue #3594
BUG: Hover on component when parent of editor scrolls, show wrong positioning
Version: 0.17.19 Are you able to reproduce the bug from the demo? No, because its full screen and there is no parent container scroll. What...
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.