From 8a860b625cd0e2f6d89552efd74e75069dcef5bf Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 11 Feb 2020 11:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=86=E7=B1=BB=E8=BF=87?= =?UTF-8?q?=E6=BB=A4/=E6=90=9C=E7=B4=A2=20=E4=BF=AE=E5=A4=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=96=87=E4=BB=B6=E5=90=8E=E4=BB=8D=E5=8F=AF=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/Dial/Create.js | 2 +- src/component/FileManager/ImgPreview.js | 1 - src/component/Navbar/Navbar.js | 2 +- src/component/Navbar/SearchBar.js | 55 ++++++++++++++----- src/component/Upload/Uploader.js | 71 +++++++++++++++---------- 5 files changed, 87 insertions(+), 44 deletions(-) diff --git a/src/component/Dial/Create.js b/src/component/Dial/Create.js index 91eafac..89fa562 100644 --- a/src/component/Dial/Create.js +++ b/src/component/Dial/Create.js @@ -6,7 +6,7 @@ import SpeedDialAction from "@material-ui/lab/SpeedDialAction"; import CreateNewFolderIcon from "@material-ui/icons/CreateNewFolder"; import PublishIcon from "@material-ui/icons/Publish"; import {openCreateFolderDialog, openRemoteDownloadDialog, toggleSnackbar} from "../../actions"; -import { useDispatch } from "react-redux"; +import {useDispatch, useSelector} from "react-redux"; import AutoHidden from "./AutoHidden"; import statusHelper from "../../untils/page" import Backdrop from "@material-ui/core/Backdrop"; diff --git a/src/component/FileManager/ImgPreview.js b/src/component/FileManager/ImgPreview.js index 0619fda..6a89752 100644 --- a/src/component/FileManager/ImgPreview.js +++ b/src/component/FileManager/ImgPreview.js @@ -5,7 +5,6 @@ import { baseURL } from "../../middleware/Api"; import { showImgPreivew } from "../../actions/index"; import { imgPreviewSuffix } from "../../config"; import { withStyles } from "@material-ui/core"; -import "react-image-lightbox/style.css"; import pathHelper from "../../untils/page"; import {withRouter} from "react-router"; import {PhotoSlider} from "react-photo-view"; diff --git a/src/component/Navbar/Navbar.js b/src/component/Navbar/Navbar.js index 2a6b6cb..087a36e 100644 --- a/src/component/Navbar/Navbar.js +++ b/src/component/Navbar/Navbar.js @@ -370,7 +370,7 @@ class NavbarCompoment extends Component { }; filterFile = type => { - this.props.searchMyFile("{filterType:" + type + "}"); + this.props.searchMyFile(type+"/internal"); }; openPreview = () => { diff --git a/src/component/Navbar/SearchBar.js b/src/component/Navbar/SearchBar.js index a1f50d0..f0196a1 100644 --- a/src/component/Navbar/SearchBar.js +++ b/src/component/Navbar/SearchBar.js @@ -20,6 +20,11 @@ import { } from "@material-ui/core"; import {withRouter} from "react-router"; import pathHelper from "../../untils/page"; +import {HotKeys,configure} from "react-hotkeys"; + +configure({ + ignoreTags:[], +}); const mapStateToProps = state => { return {}; @@ -85,10 +90,29 @@ const styles = theme => ({ } }); +const keyMap = { + SEARCH: "enter", +}; + class SearchBarCompoment extends Component { - state = { - anchorEl: null, - input: "" + + constructor(props) { + super(props); + this.state = { + anchorEl: null, + input: "" + }; + } + + handlers={ + SEARCH:(e)=>{ + if(pathHelper.isHomePage(this.props.location.pathname)){ + this.searchMyFile(); + }else{ + this.searchShare(); + } + e.target.blur(); + }, }; handleChange = event => { @@ -114,6 +138,7 @@ class SearchBarCompoment extends Component { window.location.href = "/Explore/Search/" + this.input; }; + render() { const { classes } = this.props; const { anchorEl } = this.state; @@ -121,20 +146,22 @@ class SearchBarCompoment extends Component { const isHomePage = pathHelper.isHomePage(this.props.location.pathname); return ( -