Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change 'lookUpwardForInlineStyle' from O(n^2) to O(n).
Summary: **Summary** The function 'lookUpwardForInlineStyle' repeatedly called 'getPreviousBlock' which has the complexity O(n). This tanks performance when creating a document with lots of empty lines. Simply holding down the enter key will quickly cause the frame rate to drop below 1fps. The fix is straightforward and, in my opinion, preferable to a while loop. **Test Plan** I did some manual testing. The code was able to correctly (and efficiently) find the correct style. Closes facebookarchive/draft-js#1429 Differential Revision: D6060417 fbshipit-source-id: 8a14af25f776ac5263747e2fc4bbb665884ad970
- Loading branch information