1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-03 20:07:35 +02:00

commandpalette: handle edge cases

This commit is contained in:
Kushagra Gour
2019-03-14 01:37:30 +05:30
parent 9903e2c269
commit 6dcb3f9dae

View File

@@ -78,7 +78,7 @@ export class CommandPalette extends Component {
});
return;
}
if (e.which === ENTER_KEY) {
if (e.which === ENTER_KEY && this.state.list.length) {
this.selectOption(this.state.list[this.state.selectedIndex]);
}
}
@@ -118,6 +118,9 @@ export class CommandPalette extends Component {
onKeyUp={this.keyDownHandler.bind(this)}
style="width:100%"
/>
{!this.props.files.length && !this.state.list.length ? (
<p>Nothing to search here.</p>
) : null}
<ul class="command-palette__option-list">
{this.state.list.map((item, index) => (
<Row