grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Resize by class :(

Open edwinjoel1984 opened this issue 7 years ago • 5 comments

The main problem that i have is I'm trying to do a resize in a component that I made, but if I have Two Components equals, when I do the resize one of them the other do the same resize. So, I think that I would need manage the style of them by id and not by class.

This is my code: const buttonComponent = { name: "button-bk", data: { id: "button", label: Button, category: "Basic Components", draggable: true, content: , }, }; editor.BlockManager.add('button', buttonComponent); View Example https://cl.ly/c4bfaf626adc

Originally posted by @edwinjoel1984 in https://github.com/artf/grapesjs/issues/2435#issuecomment-560447001

edwinjoel1984 avatar Dec 02 '19 15:12 edwinjoel1984

@artf this is the problem

edwinjoel1984 avatar Dec 02 '19 15:12 edwinjoel1984

even i am facing the same issue its probably issue with precedence, assume incase i have an id and class for the same element i.e <table id="myId" class="myClass"> ..... </table> and trying to resize a table then styles are applying on .myClass not #myId

why class taking more precedence than id

how to fix

live demo here : https://stackblitz.com/edit/react-mcv9vz

ramusesan avatar Dec 03 '19 13:12 ramusesan

@ramusesan @edwinjoel1984 your issues is because of the shared selectors. similar issue here. for the solution i suggest this thread. cheers!

pouyamiralayi avatar Dec 03 '19 16:12 pouyamiralayi

@pouyamiralayi what you mean of the shared selectors, if am using same class on both elements then we can say as that class is shared .
but here i am using id also right along with class name i.e <table id="myId" class="myClass"> ..... </table> ID should take more precedence than class but here class taking more precedence than id

ramusesan avatar Dec 04 '19 04:12 ramusesan

@ramusesan @edwinjoel1984 Already replied here what to do, you just have to tell the editor to style only the component and not the class...

artf avatar Dec 08 '19 20:12 artf