This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft-js: clean up useless divs from HTML when pasting content
Summary: When pasting rich (HTML) content into a Draft editor, the generated blocks are flattened such that they can be represented in the internal state model. Until a change to the tree-based model is fully implemented, that may cause formatting to be lost if the content is wrapped in multiple levels of divs, as the parsing does not traverse them deeply. Improve the amount of formatting that can be preserved in the current model by stripping out divs considered 'useless' (with no text or styling), such that more important elements can be 'brought to the surface' and parsed in a more pleasant manner. Reviewed By: claudiopro Differential Revision: D15923965 fbshipit-source-id: 72824ddba69b5d08374f505187ed4a6ea7c4d573
- Loading branch information
1 parent
ceaeebf
commit 0f5427a
Showing
3 changed files
with
104 additions
and
4 deletions.
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