This is a feature request.
Currently there's a way to apply inline styles to a selection, and add a class to a block, but there is not a way to add an inline style to a block. Adding something like text-indent, which has to be applied on the block element and can have an almost endless list of possible values, it's not realistic to create all the needed classes.
Hi, Did you find any solution to this?
I do this by change the Draft source , to add a style property in block's data and apply the block style in DraftEditorContents.react.js
@devanecondition - thanks for opening this issue. I think what you are asking can be phrased as applying dynamic styles to a block? That, then, sounds like a dupe of https://github.com/facebook/draft-js/issues/52 - can you close if is actually a dupe?
@davidchang although the request is very similar, this is not actually a dupe. Building a customStyleMap will not apply styles to a block level HTML element (p, h1, etc...), but rather to a nested span, which prevents some styles like text-indent from working.
@hingermayank I have not found a great solution. I am currently using the blockStyleFn to apply the block key as a class, and then dynamically building a style sheet based on what styles should be applied to each block.
Any solution for this issue yet ?
Most helpful comment
Any solution for this issue yet ?