facebookarchive/draft-js

getCurrentInlineStyle behaves inconsistently

Open

#722 aberto em 17 de out. de 2016

Ver no GitHub
 (3 comments) (6 reactions) (0 assignees)JavaScript (2.646 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (22.554 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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

Guia do colaborador