Merge branch 'release/v2.5.0' of github.com:ONLYOFFICE/DocSpace-client into release/v2.5.0
This commit is contained in:
commit
02c1419952
@ -27,7 +27,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useDropzone } from "react-dropzone";
|
||||||
import { setDocumentTitle } from "SRC_DIR/helpers/utils";
|
import { setDocumentTitle } from "SRC_DIR/helpers/utils";
|
||||||
|
|
||||||
import Header from "./sub-components/header";
|
import Header from "./sub-components/header";
|
||||||
@ -60,6 +60,23 @@ const PluginPage = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation(["WebPlugins", "Common"]);
|
const { t } = useTranslation(["WebPlugins", "Common"]);
|
||||||
|
|
||||||
|
const onDrop = (files) => {
|
||||||
|
let formData = new FormData();
|
||||||
|
|
||||||
|
formData.append("file", files[0]);
|
||||||
|
addPlugin(formData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const { getRootProps, getInputProps } = useDropzone({
|
||||||
|
maxFiles: 1,
|
||||||
|
noClick: withUpload,
|
||||||
|
noKeyboard: withUpload,
|
||||||
|
// maxSize: 1000000,
|
||||||
|
accept: [".zip"],
|
||||||
|
// @ts-expect-error onDrop
|
||||||
|
onDrop,
|
||||||
|
});
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setDocumentTitle(t("Common:Plugins"));
|
setDocumentTitle(t("Common:Plugins"));
|
||||||
}, []);
|
}, []);
|
||||||
@ -71,24 +88,31 @@ const PluginPage = ({
|
|||||||
<ListLoader withUpload={withUpload} />
|
<ListLoader withUpload={withUpload} />
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
) : isEmptyList ? (
|
) : isEmptyList ? (
|
||||||
<StyledEmptyContainer>
|
<StyledEmptyContainer {...getRootProps()}>
|
||||||
<EmptyScreen
|
<EmptyScreen
|
||||||
t={t}
|
t={t}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
onAddAction={addPlugin}
|
onAddAction={addPlugin}
|
||||||
currentColorScheme={currentColorScheme}
|
currentColorScheme={currentColorScheme}
|
||||||
withUpload={withUpload}
|
withUpload={withUpload}
|
||||||
|
inputProps={getInputProps()}
|
||||||
/>
|
/>
|
||||||
</StyledEmptyContainer>
|
</StyledEmptyContainer>
|
||||||
) : (
|
) : (
|
||||||
<StyledContainer>
|
<StyledContainer {...getRootProps()}>
|
||||||
{/* <Header
|
{/* <Header
|
||||||
t={t}
|
t={t}
|
||||||
currentColorScheme={currentColorScheme}
|
currentColorScheme={currentColorScheme}
|
||||||
|
|
||||||
withUpload={withUpload}
|
withUpload={withUpload}
|
||||||
/> */}
|
/> */}
|
||||||
{withUpload && <UploadButton t={t} addPlugin={addPlugin} />}
|
{withUpload && (
|
||||||
|
<UploadButton
|
||||||
|
t={t}
|
||||||
|
addPlugin={addPlugin}
|
||||||
|
inputProps={getInputProps()}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<PluginListContainer>
|
<PluginListContainer>
|
||||||
{pluginList.map((plugin) => (
|
{pluginList.map((plugin) => (
|
||||||
<PluginItem
|
<PluginItem
|
||||||
|
@ -43,6 +43,7 @@ const EmptyScreen = ({
|
|||||||
currentColorScheme,
|
currentColorScheme,
|
||||||
|
|
||||||
withUpload,
|
withUpload,
|
||||||
|
inputProps,
|
||||||
}) => {
|
}) => {
|
||||||
const imageSrc = theme.isBase
|
const imageSrc = theme.isBase
|
||||||
? EmptyScreenPluginsUrl
|
? EmptyScreenPluginsUrl
|
||||||
@ -55,7 +56,11 @@ const EmptyScreen = ({
|
|||||||
style={{ gridColumnGap: "39px" }}
|
style={{ gridColumnGap: "39px" }}
|
||||||
buttonStyle={{ marginTop: "16px" }}
|
buttonStyle={{ marginTop: "16px" }}
|
||||||
imageSrc={imageSrc}
|
imageSrc={imageSrc}
|
||||||
buttons={withUpload && <UploadButton t={t} addPlugin={onAddAction} />}
|
buttons={
|
||||||
|
withUpload && (
|
||||||
|
<UploadButton t={t} addPlugin={onAddAction} inputProps={inputProps} />
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ const StyledUploadButton = styled.div`
|
|||||||
width: auto;
|
width: auto;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const UploadButton = ({ t, addPlugin }) => {
|
const UploadButton = ({ t, addPlugin, inputProps }) => {
|
||||||
const pluginInputRef = React.useRef(null);
|
const pluginInputRef = React.useRef(null);
|
||||||
|
|
||||||
const onAddAction = () => {
|
const onAddAction = () => {
|
||||||
@ -72,6 +72,7 @@ const UploadButton = ({ t, addPlugin }) => {
|
|||||||
ref={pluginInputRef}
|
ref={pluginInputRef}
|
||||||
style={{ display: "none" }}
|
style={{ display: "none" }}
|
||||||
/>
|
/>
|
||||||
|
{inputProps && <input {...inputProps} />}
|
||||||
</StyledUploadButton>
|
</StyledUploadButton>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -64,6 +64,7 @@ import {
|
|||||||
} from "../helpers/plugins/enums";
|
} from "../helpers/plugins/enums";
|
||||||
|
|
||||||
import SelectedFolderStore from "./SelectedFolderStore";
|
import SelectedFolderStore from "./SelectedFolderStore";
|
||||||
|
import { getCSPSettings } from "@docspace/shared/api/settings";
|
||||||
|
|
||||||
const { api: apiConf, proxy: proxyConf } = defaultConfig;
|
const { api: apiConf, proxy: proxyConf } = defaultConfig;
|
||||||
const { origin: apiOrigin, prefix: apiPrefix } = apiConf;
|
const { origin: apiOrigin, prefix: apiPrefix } = apiConf;
|
||||||
|
Loading…
Reference in New Issue
Block a user