-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix outside click logic for committing changes #1404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, pal. Only 2 minor suggestions
handleDocumentClick = (e) => { | ||
const { target } = e; | ||
const { container, editor } = this; | ||
const isClickedInsideEditorContainer = container !== null && (target === container || container.contains(target)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of container !== null && ...
could we use one of the below?
const isClickedInsideEditorContainer = container !== null && (target === container || container.contains(target)); | |
const isClickedInsideEditorContainer = container && (target === container || container.contains(target)); |
const isClickedInsideEditorContainer = container !== null && (target === container || container.contains(target)); | |
const isClickedInsideEditorContainer = !!container && (target === container || container.contains(target)); |
const { container, editor } = this; | ||
const isClickedInsideEditorContainer = container !== null && (target === container || container.contains(target)); | ||
let isClickedInsideEditor = false; | ||
if (editor !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above...
if (editor !== null) { | |
if (editor) { |
if (editor !== null) { | |
if (!!editor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React will assign the current property with the DOM element when the component mounts, and assign it back to null when it unmounts
I usually prefer an explicit check than using the !!
operator but either works
- Fix unit tests
* Fix outside click logic for committing changes * - Cleanup up outside click logic - Fix unit tests * Cleanup up if condition * Add unit tests for editors using portals
No description provided.