Closed gdad-s-river closed 6 years ago
Hi thx for posting, which method are you using to apply the styles?
addFontSize
initiated with color picker util
Reproducing steps to see it in action :
layout-rewrite
branchOk awesome. That one does not add the inlineStyleOverride. It uses the draft-js API to set it. I might be able to modify it so you can apply the override to collapsed/non-collapsed .
@webdeveloperpr, it'd be really cool if you could do that :) , because I'd been struggling on how to :D
I'll see if I can get it working tonight, and send you a link to an example so you can check it out.
That'd be nice, thank you so much 😊
@webdeveloperpr anytime you could would be fine really. Whenever you are not occupied.
@gdad-s-river : There can be 2 fixes:
@gdad-s-river I added the changes to the repo and tested out your layout-rewrite
branch using draft-js-custom-styles@2.0.2
. Collapsed style now have inlineStyleOverrides added when using add()
.
Also @jpuri thx for suggestions!
@webdeveloperpr thanks a lot for being so quick on the request. Really appreciate it 😃
Since
Modifier.applyInlineStyles
is used to modify the inline styles, I think for this reason the styles aren't applied if the selection state is collapsed. For example, in this poetry editor that I'm coding up, when I change the slider and usedraft-js-custom-styles
to change the inline styles (font size), it only works if some text is selected.My intended behaviour is that, even if nothing is selected (collapsed selection state), then also the inline styles should be applied to the character that will be entered there after (I think
RichUtils.toggleInlineStyles
does that). Any idea how could I do that ?Thanks!