facebookarchive/draft-js

getCurrentInlineStyle behaves inconsistently

Open

#722 opened on Oct 17, 2016

View on GitHub
 (3 comments) (6 reactions) (0 assignees)JavaScript (22,554 stars) (2,646 forks)batch import
bughelp wanted

Description

I believe there is a bug in getCurrentInlineStyle (or, if it's current behavior is intentional, it is inconsistent with typical rich text editor behavior).

When selecting a block of text in which different characters have different styles, getCurrentInlineStyle usually doesn't show styles that aren't applied to the entire selection. This seems to be standard practice. However, it will show styles that are applied to the very start of the selection, even if they aren't applied throughout, which seems inconsistent.

This can be observed in the sample editor at https://facebook.github.io/draft-js/ Enter : foo bar bat. Highlight the whole line and the bold button will not be lit. Highlight "foo bar" and, again, bold is unlit. Highlight "bar bat" and bold will light, despite the fact that all the characters in the selection are not bold.

I'm seeing this in version 0.9.1

Contributor guide