Skip to content

Commit

Permalink
[form-builder] Optimize selectionchange event handlers in Formbuilder…
Browse files Browse the repository at this point in the history
…Block/FormBuilderInline (#555)
  • Loading branch information
bjoerge authored Feb 4, 2018
1 parent f695eab commit c6407a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ export default class FormBuilderBlock extends React.Component {
}

handleSelectionChange = event => {
if (!this._editorNode.contains(event.target)) {
return
}
const selection = document.getSelection()
const isSelected = selection.containsNode
&& selection.containsNode(this.formBuilderBlock)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default class FormBuilderInline extends React.Component {
}

handleSelectionChange = event => {
if (!this._editorNode.contains(event.target)) {
return
}
const selection = document.getSelection()
const isSelected = selection.containsNode
&& selection.containsNode(this.formBuilderInline)
Expand Down

0 comments on commit c6407a8

Please sign in to comment.