mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 11:03:13 +00:00
Merge pull request #2085 from MatthewShao/dev
[web] Add mouse support for FilterInput popover.
This commit is contained in:
commit
22154dee5c
@ -113,5 +113,12 @@ header {
|
|||||||
.popover-content {
|
.popover-content {
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
|
tr {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background-color: hsla(209, 52%, 84%, 0.5) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export default class FilterDocs extends Component {
|
|||||||
<table className="table table-condensed">
|
<table className="table table-condensed">
|
||||||
<tbody>
|
<tbody>
|
||||||
{doc.commands.map(cmd => (
|
{doc.commands.map(cmd => (
|
||||||
<tr key={cmd[1]}>
|
<tr key={cmd[1]} onClick={e => this.props.selectHandler(cmd[0].split(" ")[0] + " ")}>
|
||||||
<td>{cmd[0].replace(' ', '\u00a0')}</td>
|
<td>{cmd[0].replace(' ', '\u00a0')}</td>
|
||||||
<td>{cmd[1]}</td>
|
<td>{cmd[1]}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -21,6 +21,7 @@ export default class FilterInput extends Component {
|
|||||||
this.onKeyDown = this.onKeyDown.bind(this)
|
this.onKeyDown = this.onKeyDown.bind(this)
|
||||||
this.onMouseEnter = this.onMouseEnter.bind(this)
|
this.onMouseEnter = this.onMouseEnter.bind(this)
|
||||||
this.onMouseLeave = this.onMouseLeave.bind(this)
|
this.onMouseLeave = this.onMouseLeave.bind(this)
|
||||||
|
this.selectFilter = this.selectFilter.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
@ -41,7 +42,7 @@ export default class FilterInput extends Component {
|
|||||||
|
|
||||||
getDesc() {
|
getDesc() {
|
||||||
if (!this.state.value) {
|
if (!this.state.value) {
|
||||||
return <FilterDocs/>
|
return <FilterDocs selectHandler={this.selectFilter}/>
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return Filt.parse(this.state.value).desc
|
return Filt.parse(this.state.value).desc
|
||||||
@ -85,6 +86,11 @@ export default class FilterInput extends Component {
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectFilter(cmd) {
|
||||||
|
this.setState({value: cmd})
|
||||||
|
ReactDOM.findDOMNode(this.refs.input).focus()
|
||||||
|
}
|
||||||
|
|
||||||
blur() {
|
blur() {
|
||||||
ReactDOM.findDOMNode(this.refs.input).blur()
|
ReactDOM.findDOMNode(this.refs.input).blur()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user