Get CSS of selected component ?
Question
Hello how can i get css of selected component ?
Answers (3)
You could listen the event component:selected, then you could get the component's DOM element from that. Afterwards, you could simply use javascript to get style of that component. About getting style by javascript, you can check this link How to get CSS values in JavaScript
Here is an example:
editor.on('component:selected', (component) => {
const domElement = component.getEl();
const style = window.getComputedStyle(domElement)
})
You can also get the currently selected component by doing editor.getSelected()
How to get/setStyle() of hover state from a component? this is posible?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2861
[HELP] Get css of selected component and its children
Hi, i'm trying to implement possibility to save elements as custom blocks. How can i get css of component and its children? I can recursive...
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...
Issue #2922
[QUESTION]: Get all css without specific component and it's children
Hi, so, in this issue #2861 we can get all the css of a selected element and it's children with: But if I want to get all the css but witho...
Issue #2511
How to open a sector when selecting a element?
Hello everybody How do i open a selector like general as i select the element. I am new to javascript, but i tried something out like this....
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.