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

Fix selection throwing when null #3172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ASudre
Copy link

@ASudre ASudre commented Oct 11, 2022

Before submitting a pull request, please make sure the following is done...

  1. Fork the repo and create your branch from master.
  2. If you've added code that should be tested, add tests!
  3. If you've changed APIs, update the documentation.
  4. Ensure that:
  • The test suite passes (npm test)
  • Your code lints (npm run lint) and passes Flow (npm run flow)
  • You have followed the testing guidelines
  1. If you haven't already, complete the CLA.

Please use the simple form below as a guideline for describing your pull request, and delete these instructions.

Thanks for contributing to Draft.js!


Summary

An issue occurs while using the toolbar inline plugin, an error is thrown in the method getVisibleSelectionRect because the value of the selection is null.
The fix is to use ?. on the existing if test of selection.rangeCount to avoid this error.

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.

2 participants