grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

defautl class on block

Open gerabu opened this issue 8 years ago • 3 comments

I'm trying to add a custom block 1

and work fine, except that the styles attributes are set to a default class, for example 2

i want those css attributes be set to the class i'm setting in the classes attribute ('header-banner') how can i do that?

gerabu avatar Dec 15 '17 21:12 gerabu

To achieve this, you need to add the style separated from the block and set the classes to the block. Look for example how this is done in the basic blocks plugin: https://github.com/artf/grapesjs-blocks-basic/blob/master/src/index.js#L29

juanj avatar Dec 18 '17 17:12 juanj

You can also do this

content: `
	<div class="header-banner">...</div>
	<style>
		.header-banner {
			...
		}
	</style>
`

artf avatar Dec 19 '17 12:12 artf

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.

lock[bot] avatar Sep 18 '19 04:09 lock[bot]