-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Draft is unhappy when text manages to get added outside of the DraftEditorTextNode span. I'd like to highlight that text in red to make it more noticeable so that people might notice what editing patterns trigger it. I would have liked to do this universally for all Draft inputs (if a certain flag is turned on), but CSS doesn't make this possible: there's no way to style just the text content in a node without styling children, and there's no way to inherit a property from the grandparent element ignoring the parent's styles. So instead you have to do this manually per editor callsite so that you actually know the correct text color. Those rules will look like: ``` .public/myEditor/root .public/DraftEditor/highlightInvalidText .public/DraftEditor/leaf { /* Draft.js errors are shown in red text when in a GK */ background: red; color: white; } .public/myEditor/root .public/DraftEditor/leaf .public/DraftEditor/textNode { background: white; color: black; /* <-- actual text color */ } ``` Reviewed By: flarnie Differential Revision: D6056162 fbshipit-source-id: e7f0dfc058535f5666221e4f51ff3d01336e4c0a
- Loading branch information
1 parent
6a6e7da
commit bf71861
Showing
4 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters