Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion editor/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { connect } from 'react-redux';
import { uniq, get, reduce } from 'lodash';
import clickOutside from 'react-click-outside';

/**
* Internal dependencies
Expand All @@ -19,6 +20,14 @@ class BlockSwitcher extends wp.element.Component {
};
}

handleClickOutside() {
if ( ! this.state.open ) {
return;
}

this.toggleMenu();
}

toggleMenu() {
this.setState( {
open: ! this.state.open
Expand Down Expand Up @@ -94,4 +103,4 @@ export default connect(
} );
}
} )
)( BlockSwitcher );
)( clickOutside( BlockSwitcher ) );
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"lodash": "^4.17.4",
"react": "^15.5.4",
"react-autosize-textarea": "^0.4.2",
"react-click-outside": "^2.3.0",
"react-dom": "^15.5.4",
"react-redux": "^5.0.4",
"react-slot-fill": "^1.0.0-alpha.11",
Expand Down