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 ( -
+
- + + + { return { - path: state.navigator.path + path: state.navigator.path, + keywords: state.explorer.keywords }; }; - + const mapDispatchToProps = dispatch => { return { refreshFileList: () => { @@ -26,7 +27,7 @@ const mapDispatchToProps = dispatch => { }, toggleSnackbar: (vertical, horizontal, msg, color) => { dispatch(toggleSnackbar(vertical, horizontal, msg, color)); - }, + } }; }; @@ -46,24 +47,30 @@ class UploaderComponent extends Component { this.uploader.removeFile(file); } - getChunkSize(policyType){ - if(policyType === "qiniu"){ - return 4*1024*1024 + getChunkSize(policyType) { + if (policyType === "qiniu") { + return 4 * 1024 * 1024; } - if(policyType === "onedrive"){ - return 10*1024*1024 + if (policyType === "onedrive") { + return 10 * 1024 * 1024; } - return 0 + return 0; } - fileAdd = (up,files)=>{ - if(window.location.href.split("#")[1].toLowerCase().startsWith("/home")){ + fileAdd = (up, files) => { + if ( + this.props.keywords === null && + window.location.href + .split("#")[1] + .toLowerCase() + .startsWith("/home") + ) { window.fileList["openFileList"](); window.plupload.each(files, files => { window.pathCache[files.id] = this.props.path; window.fileList["enQueue"](files); }); - }else{ + } else { window.plupload.each(files, files => { up.removeFile(files); }); @@ -88,14 +95,17 @@ class UploaderComponent extends Component { dragdrop: true, chunk_size: this.getChunkSize(user.policy.saveType), filters: { - mime_types: user.policy.allowedType === null ? [] : user.policy.allowedType, + mime_types: + user.policy.allowedType === null + ? [] + : user.policy.allowedType }, // iOS不能多选? multi_selection: true, uptoken_url: "/api/v3/file/upload/credential", - uptoken:user.policy.saveType === "local" ? "token" : null, + uptoken: user.policy.saveType === "local" ? "token" : null, domain: "s", - max_retries:0, + max_retries: 0, get_new_uptoken: true, auto_start: true, log_level: 5, @@ -113,20 +123,26 @@ class UploaderComponent extends Component { if (file.length === 0) { return; } - console.log("UploadComplete",file[0].status,file[0]); + console.log( + "UploadComplete", + file[0].status, + file[0] + ); for (var i = 0; i < file.length; i++) { if (file[i].status === 5) { window.fileList["setComplete"](file[i]); } } // 无异步操作的策略,直接刷新 - if (user.policy.saveType !== "onedrive" && user.policy.saveType !== "cos"){ + if ( + user.policy.saveType !== "onedrive" && + user.policy.saveType !== "cos" + ) { this.props.refreshFileList(); this.props.refreshStorage(); } - }, - Fresh:()=>{ + Fresh: () => { this.props.refreshFileList(); this.props.refreshStorage(); }, @@ -156,7 +172,10 @@ class UploaderComponent extends Component { inRef={this.setRef.bind(this)} cancelUpload={this.cancelUpload.bind(this)} /> - + {this.props.keywords === null &&}
); } @@ -164,8 +183,6 @@ class UploaderComponent extends Component { const Uploader = connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true -})( - uploaderLoader()(UploaderComponent) -); +})(uploaderLoader()(UploaderComponent)); export default Uploader;