You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working with GrapesJS and trying to get correct values from the selected component and push them into the Style Manager. I’m facing an issue where I can retrieve the font values, but they are not reflected in the Style Manager.
Here’s my code for capturing the style information:
console.log(`Font family: ${fontFamily}, Font size: ${fontSize}, Font weight: ${fontWeight}`);
});
In this code, I can log the correct values to the console, but I'm unable to update them in the Style Manager.
I also tried the following approach:
editor.on("component:selected", (component) => {
const element = component.view.el;
const computedStyles = window.getComputedStyle(element);
});
With this, I can get the values in the console, but the values are not being reflected in the Style Manager.
Additionally, even when I manually change a style (like font size or color) in the Style Manager, these changes are not being reflected on the page. It seems like the style manager is not updating the component on the canvas properly.
Could someone guide me on how to properly update the Style Manager with the correct values and ensure that any changes made in the Style Manager are reflected on the page?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone,
I’m working with GrapesJS and trying to get correct values from the selected component and push them into the Style Manager. I’m facing an issue where I can retrieve the font values, but they are not reflected in the Style Manager.
Here’s my code for capturing the style information:
editor.on('component:selected', (component) => {
const style = component.getStyle();
const fontFamily = style['font-family'];
const fontSize = style['font-size'];
const fontWeight = style['font-weight'];
});
In this code, I can log the correct values to the console, but I'm unable to update them in the Style Manager.
I also tried the following approach:
editor.on("component:selected", (component) => {
const element = component.view.el;
const computedStyles = window.getComputedStyle(element);
});
With this, I can get the values in the console, but the values are not being reflected in the Style Manager.
Additionally, even when I manually change a style (like font size or color) in the Style Manager, these changes are not being reflected on the page. It seems like the style manager is not updating the component on the canvas properly.
Could someone guide me on how to properly update the Style Manager with the correct values and ensure that any changes made in the Style Manager are reflected on the page?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions