mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-26 04:02:47 +00:00
fix: cannot select code language automatically / code editor height auto-fit into view height
This commit is contained in:
parent
bda2e2758a
commit
16df89188a
|
|
@ -6,6 +6,7 @@ import CustomPaginationItem from "./PaginationItem";
|
|||
import { setPagination } from "../../redux/viewUpdate/action";
|
||||
import AutoHidden from "../Dial/AutoHidden";
|
||||
import statusHelper from "../../utils/page";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
|
@ -31,6 +32,7 @@ export default function PaginationFooter() {
|
|||
const folders = useSelector((state) => state.explorer.dirList);
|
||||
const pagination = useSelector((state) => state.viewUpdate.pagination);
|
||||
const loading = useSelector((state) => state.viewUpdate.navigatorLoading);
|
||||
const location = useLocation();
|
||||
|
||||
const SetPagination = useCallback((p) => dispatch(setPagination(p)), [
|
||||
dispatch,
|
||||
|
|
@ -46,11 +48,14 @@ export default function PaginationFooter() {
|
|||
);
|
||||
|
||||
const isMobile = statusHelper.isMobile();
|
||||
const isSharePage = statusHelper.isSharePage(location.pathname);
|
||||
|
||||
if (count > 1 && !loading) {
|
||||
return (
|
||||
<>
|
||||
{!isMobile && <div className={classes.placeholder} />}
|
||||
{!isMobile && !isSharePage && (
|
||||
<div className={classes.placeholder} />
|
||||
)}
|
||||
<AutoHidden enable>
|
||||
<div className={classes.root}>
|
||||
<Pagination
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const useStyles = makeStyles((theme) => ({
|
|||
marginLeft: "auto",
|
||||
marginRight: "auto",
|
||||
},
|
||||
marginBottom: 50,
|
||||
marginBottom: 40,
|
||||
},
|
||||
editor: {
|
||||
borderRadius: "4px",
|
||||
|
|
@ -79,7 +79,7 @@ export default function CodeViewer() {
|
|||
const extension = title.split(".");
|
||||
setSuffix(codePreviewSuffix[extension.pop()]);
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
}, [title]);
|
||||
|
||||
useEffect(() => {
|
||||
let requestURL = "/file/content/" + query.get("id");
|
||||
|
|
@ -171,7 +171,7 @@ export default function CodeViewer() {
|
|||
{!loading && (
|
||||
<Suspense fallback={<TextLoading />}>
|
||||
<MonacoEditor
|
||||
height="600"
|
||||
height="calc(100vh - 198px)"
|
||||
language={suffix}
|
||||
theme={
|
||||
theme.palette.type === "dark" ? "vs-dark" : "vs"
|
||||
|
|
|
|||
Loading…
Reference in New Issue