This commit is contained in:
Matt Panaro 2024-05-17 14:05:46 +00:00 committed by GitHub
commit dc0e91017a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -164,6 +164,25 @@ class Search extends PureComponent {
this.setState({ expanded: false, selectedOption: -1 });
};
handleDragOver = (e) => {
e.preventDefault();
};
handleDrop = (e) => {
const { onChange } = this.props;
e.preventDefault();
this.setState({ expanded: true, selectedOption: -1 });
// TODO: update the type parameter if/when `url-desc` is standardized
let query = e.dataTransfer.getData('text/x-moz-url-desc') ||
e.dataTransfer.getData('text/uri-list') ||
e.dataTransfer.getData('text/plain');
onChange(query);
this._calculateOptions(query);
e.target.focus();
};
handleHashtagClick = () => {
const { value, onClickSearchResult, history } = this.props;
@ -335,6 +354,8 @@ class Search extends PureComponent {
onKeyDown={this.handleKeyDown}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
onDragOver={this.handleDragOver}
onDrop={this.handleDrop}
/>
<div role='button' tabIndex={0} className='search__icon' onClick={this.handleClear}>