mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-22 20:08:19 +00:00
Fix code bug (#6299)
* fix search ref bug * fix no global var * fix search mask open and keyEvent can use
This commit is contained in:
@@ -132,16 +132,19 @@ export default class AISearch extends Component {
|
||||
if (this.inputRef && this.inputRef.current) {
|
||||
this.inputRef.current.focus();
|
||||
}
|
||||
} else if (isHotkey('esc', e)) {
|
||||
e.preventDefault();
|
||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||
this.resetToDefault();
|
||||
} else if (isHotkey('enter', e)) {
|
||||
this.onEnter(e);
|
||||
} else if (isHotkey('up', e)) {
|
||||
this.onUp(e);
|
||||
} else if (isHotkey('down', e)) {
|
||||
this.onDown(e);
|
||||
}
|
||||
if (this.state.isMaskShow) {
|
||||
if (isHotkey('esc', e)) {
|
||||
e.preventDefault();
|
||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||
this.resetToDefault();
|
||||
} else if (isHotkey('enter', e)) {
|
||||
this.onEnter(e);
|
||||
} else if (isHotkey('up', e)) {
|
||||
this.onUp(e);
|
||||
} else if (isHotkey('down', e)) {
|
||||
this.onDown(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -660,7 +663,7 @@ export default class AISearch extends Component {
|
||||
return (
|
||||
<>
|
||||
<MediaQuery query="(min-width: 768px)">
|
||||
<div className="search-result-list-container">{results}</div>
|
||||
<div className="search-result-list-container" ref={this.searchResultListContainerRef}>{results}</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery query="(max-width: 767.8px)">
|
||||
{results}
|
||||
|
@@ -94,16 +94,19 @@ class Search extends Component {
|
||||
if (this.inputRef && this.inputRef.current) {
|
||||
this.inputRef.current.focus();
|
||||
}
|
||||
} else if (isHotkey('esc', e)) {
|
||||
e.preventDefault();
|
||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||
this.resetToDefault();
|
||||
} else if (isEnter(e)) {
|
||||
this.onEnter(e);
|
||||
} else if (isUp(e)) {
|
||||
this.onUp(e);
|
||||
} else if (isDown(e)) {
|
||||
this.onDown(e);
|
||||
}
|
||||
if (this.state.isMaskShow) {
|
||||
if (isHotkey('esc', e)) {
|
||||
e.preventDefault();
|
||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||
this.resetToDefault();
|
||||
} else if (isEnter(e)) {
|
||||
this.onEnter(e);
|
||||
} else if (isUp(e)) {
|
||||
this.onUp(e);
|
||||
} else if (isDown(e)) {
|
||||
this.onDown(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user