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:
@@ -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
|
||||
|
Reference in New Issue
Block a user