Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

fix(selection): Returns previous selection if either leaf is null #2189

Closed
wants to merge 3 commits into from

Conversation

claudiopro
Copy link
Contributor

@claudiopro claudiopro commented Sep 20, 2019

Summary

Bails out early from the getUpdatedSelectionState method with previous selection when anchorLeaf or focusLeaf are null to prevent an error surfaced when using a decorator for emoji inserted between two spans of text entered via IME.

Thanks to @robbertbrak for suggesting and cherry-picking a fix from their fork 🎉

Fixes #2187

Test Plan

  1. Build Draft.js
  2. Inject into jsfiddle reported by @jdecked https://jsfiddle.net/36tvhmce/
  3. Try to repro issues with Pinyin and Hiragana IME
  4. Verify there is no error in the console and text is entered normally

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claudiopro has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claudiopro has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link

@claudiopro merged this pull request in fe68e43.

jdecked pushed a commit to twitter-forks/draft-js that referenced this pull request Oct 9, 2019
…cebookarchive#2189)

Summary:
**Summary**

Bails out early from the `getUpdatedSelectionState` method with previous selection when `anchorLeaf` or `focusLeaf` are null to prevent an error surfaced when using a decorator for emoji inserted between two spans of text entered via IME.

Thanks to robbertbrak for suggesting and cherry-picking a fix from their fork 🎉

Fixes facebookarchive#2187

**Test Plan**
1. Build Draft.js
1. Inject into jsfiddle reported by jdecked https://jsfiddle.net/36tvhmce/
1. Try to repro issues with Pinyin and Hiragana IME
1. Verify there is no error in the console and text is entered normally
Pull Request resolved: facebookarchive#2189

Reviewed By: kedromelon

Differential Revision: D17504999

Pulled By: claudiopro

fbshipit-source-id: dbd2180cf5c1af5bbe1c2b94c50767c58f524dcf
mmissey pushed a commit to mmissey/draft-js that referenced this pull request Mar 24, 2020
…cebookarchive#2189)

Summary:
**Summary**

Bails out early from the `getUpdatedSelectionState` method with previous selection when `anchorLeaf` or `focusLeaf` are null to prevent an error surfaced when using a decorator for emoji inserted between two spans of text entered via IME.

Thanks to robbertbrak for suggesting and cherry-picking a fix from their fork 🎉

Fixes facebookarchive#2187

**Test Plan**
1. Build Draft.js
1. Inject into jsfiddle reported by jdecked https://jsfiddle.net/36tvhmce/
1. Try to repro issues with Pinyin and Hiragana IME
1. Verify there is no error in the console and text is entered normally
Pull Request resolved: facebookarchive#2189

Reviewed By: kedromelon

Differential Revision: D17504999

Pulled By: claudiopro

fbshipit-source-id: dbd2180cf5c1af5bbe1c2b94c50767c58f524dcf
alicayan008 pushed a commit to alicayan008/draft-js that referenced this pull request Jul 4, 2023
…189)

Summary:
**Summary**

Bails out early from the `getUpdatedSelectionState` method with previous selection when `anchorLeaf` or `focusLeaf` are null to prevent an error surfaced when using a decorator for emoji inserted between two spans of text entered via IME.

Thanks to robbertbrak for suggesting and cherry-picking a fix from their fork 🎉

Fixes facebookarchive/draft-js#2187

**Test Plan**
1. Build Draft.js
1. Inject into jsfiddle reported by jdecked https://jsfiddle.net/36tvhmce/
1. Try to repro issues with Pinyin and Hiragana IME
1. Verify there is no error in the console and text is entered normally
Pull Request resolved: facebookarchive/draft-js#2189

Reviewed By: kedromelon

Differential Revision: D17504999

Pulled By: claudiopro

fbshipit-source-id: dbd2180cf5c1af5bbe1c2b94c50767c58f524dcf
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inserting decorated emojis while using an IME crashes editor
2 participants