GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.38k stars 4.06k forks source link

[Question] Css class #1531

Closed alfaalex81 closed 5 years ago

alfaalex81 commented 5 years ago

Hi! Probably this problem is already posted, but I can't understand where I'm wrong. I use this three parameters on init GrapesJs.

                protectedCss: '',
                avoidInlineStyle: true,
                forceClass: true,

I would like GrapeJs not to edit preexisting css, but only creates its own. Is it possible?

Thank you!

alfaalex81 commented 5 years ago

For example i have this code on canvas

<div class="row">
    <div class="col-md-6" style="min-height: 50px"></div>
    <div class="col-md-6" style="min-height: 50px"></div>
</div>

GrapesJs add to CSS this class

.col-md-6 {
    min-height:  50px;
}

This rule modify all element with this class, this is a generic bootstrap class that we use in all site.

artf commented 5 years ago

@alfaalex81 I can't reproduce it, create a live demo please

alfaalex81 commented 5 years ago

https://jsfiddle.net/ugc1otnk/

In the example when i change background color in the first column, GrapesJs set the css attribute to the external class "col-md-6", that is a bootstrap class name. I prefer Grapesjs set own class.

Moreover I think I've found a bug. Select the first column and deselect class "col-md-6" on the stylee manager panel, class name "example" appears but this class is associated in the second column. It is only a visual bug.

artf commented 5 years ago

For your first issue, just set forceClass: false,, about the bug please open another issue

lock[bot] commented 4 years ago

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.