I have a draft-js component. I can add styles into StyleMap (via adding new objects into customStyleMap). However when I have a selected list and change size, it only changes size of the selected text - bullets are still same. I know I can change style of block with blockStyleFn={getBlockStyle}
but here I have two problems:
As far I know, it only works with already defined classes - but I can't have classes for every size. How can I dynamically add class?
How can I get style out of block?
So in getBlockStyle(block)
I have to do something like this:
let style = block.getStyleOfContent(); //for example returns fontSize: '16px'
addNewClass('listFontSize16px', style); //add new class
return listFontSize16px;
Or any other solution?
Ok, I figure it out...
In getBlockStyle(block)
block contains a key. Thanks to the key I can find the same key in content of editorState and there is the style.
It is not the nicest solution but it works pretty good.