Merge branch 'hotfix/v2.5.1' of github.com:ONLYOFFICE/DocSpace-client into hotfix/v2.5.1
This commit is contained in:
commit
6106484daa
@ -319,6 +319,8 @@ class FileRow extends Component {
|
|||||||
isPersonal,
|
isPersonal,
|
||||||
isMediaActive,
|
isMediaActive,
|
||||||
downloadInCurrentTab,
|
downloadInCurrentTab,
|
||||||
|
isPlugin,
|
||||||
|
onPluginClick,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { showPasswordInput, password, passwordValid } = this.state;
|
const { showPasswordInput, password, passwordValid } = this.state;
|
||||||
@ -348,13 +350,13 @@ class FileRow extends Component {
|
|||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
{item.fileId ? (
|
{item.fileId ? (
|
||||||
isMedia ? (
|
isMedia || (isPlugin && onPluginClick) ? (
|
||||||
<Link
|
<Link
|
||||||
className="upload-panel_file-row-link"
|
className="upload-panel_file-row-link"
|
||||||
fontWeight="600"
|
fontWeight="600"
|
||||||
color={item.error && "#A3A9AE"}
|
color={item.error && "#A3A9AE"}
|
||||||
truncate
|
truncate
|
||||||
onClick={onMediaClick}
|
onClick={isMedia ? onMediaClick : onPluginClick}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
{fileExtension}
|
{fileExtension}
|
||||||
@ -437,6 +439,7 @@ export default inject(
|
|||||||
uploadDataStore,
|
uploadDataStore,
|
||||||
mediaViewerDataStore,
|
mediaViewerDataStore,
|
||||||
settingsStore,
|
settingsStore,
|
||||||
|
pluginStore,
|
||||||
},
|
},
|
||||||
{ item },
|
{ item },
|
||||||
) => {
|
) => {
|
||||||
@ -460,6 +463,31 @@ export default inject(
|
|||||||
if (!!ext) splitted.splice(-1);
|
if (!!ext) splitted.splice(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { fileItemsList } = pluginStore;
|
||||||
|
const { enablePlugins, currentDeviceType } = settingsStore;
|
||||||
|
|
||||||
|
let isPlugin = false;
|
||||||
|
let onPluginClick = null;
|
||||||
|
|
||||||
|
if (fileItemsList && enablePlugins) {
|
||||||
|
let currPluginItem = null;
|
||||||
|
|
||||||
|
fileItemsList.forEach((i) => {
|
||||||
|
if (i.key === item?.fileInfo?.fileExst) currPluginItem = i.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (currPluginItem) {
|
||||||
|
const correctDevice = currPluginItem.devices
|
||||||
|
? currPluginItem.devices.includes(currentDeviceType)
|
||||||
|
: true;
|
||||||
|
if (correctDevice) {
|
||||||
|
isPlugin = true;
|
||||||
|
onPluginClick = () =>
|
||||||
|
currPluginItem.onClick({ ...item, ...item.fileInfo });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
name = splitted.join(".");
|
name = splitted.join(".");
|
||||||
|
|
||||||
const { personal, theme } = settingsStore;
|
const { personal, theme } = settingsStore;
|
||||||
@ -512,6 +540,9 @@ export default inject(
|
|||||||
|
|
||||||
setCurrentItem,
|
setCurrentItem,
|
||||||
clearUploadedFilesHistory,
|
clearUploadedFilesHistory,
|
||||||
|
|
||||||
|
isPlugin,
|
||||||
|
onPluginClick,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)(withTranslation("UploadPanel")(observer(FileRow)));
|
)(withTranslation("UploadPanel")(observer(FileRow)));
|
||||||
|
@ -81,6 +81,8 @@ export interface PluginsProps {
|
|||||||
) => Promise<unknown>;
|
) => Promise<unknown>;
|
||||||
addPlugin: (data: FormData) => Promise<void>;
|
addPlugin: (data: FormData) => Promise<void>;
|
||||||
|
|
||||||
|
updatePlugins: (fromList?: boolean) => Promise<void>;
|
||||||
|
|
||||||
currentColorScheme: TColorScheme;
|
currentColorScheme: TColorScheme;
|
||||||
theme: TTheme;
|
theme: TTheme;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ const PluginPage = ({
|
|||||||
updatePlugin,
|
updatePlugin,
|
||||||
addPlugin,
|
addPlugin,
|
||||||
|
|
||||||
|
updatePlugins,
|
||||||
|
|
||||||
theme,
|
theme,
|
||||||
isLoading,
|
isLoading,
|
||||||
isEmptyList,
|
isEmptyList,
|
||||||
@ -73,6 +75,10 @@ const PluginPage = ({
|
|||||||
setDocumentTitle(t("Common:Plugins"));
|
setDocumentTitle(t("Common:Plugins"));
|
||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
updatePlugins(true);
|
||||||
|
}, [updatePlugins]);
|
||||||
|
|
||||||
return isLoading || (!isEmptyList && pluginList.length === 0) ? (
|
return isLoading || (!isEmptyList && pluginList.length === 0) ? (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<ListLoader withUpload={withUpload} />
|
<ListLoader withUpload={withUpload} />
|
||||||
@ -133,6 +139,7 @@ export default inject(
|
|||||||
const {
|
const {
|
||||||
pluginList,
|
pluginList,
|
||||||
updatePlugin,
|
updatePlugin,
|
||||||
|
updatePlugins,
|
||||||
setCurrentSettingsDialogPlugin,
|
setCurrentSettingsDialogPlugin,
|
||||||
setSettingsPluginDialogVisible,
|
setSettingsPluginDialogVisible,
|
||||||
|
|
||||||
@ -153,6 +160,7 @@ export default inject(
|
|||||||
pluginList,
|
pluginList,
|
||||||
|
|
||||||
updatePlugin,
|
updatePlugin,
|
||||||
|
updatePlugins,
|
||||||
|
|
||||||
openSettingsDialog,
|
openSettingsDialog,
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ class PluginStore {
|
|||||||
this.setIsInit(true);
|
this.setIsInit(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
updatePlugins = async () => {
|
updatePlugins = async (fromList?: boolean) => {
|
||||||
if (!this.userStore || !this.userStore.user) return;
|
if (!this.userStore || !this.userStore.user) return;
|
||||||
|
|
||||||
const { isAdmin, isOwner } = this.userStore.user;
|
const { isAdmin, isOwner } = this.userStore.user;
|
||||||
@ -254,7 +254,7 @@ class PluginStore {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.setIsEmptyList(plugins.length === 0);
|
this.setIsEmptyList(plugins.length === 0);
|
||||||
plugins.forEach((plugin) => this.initPlugin(plugin));
|
plugins.forEach((plugin) => this.initPlugin(plugin, undefined, fromList));
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setIsLoading(false);
|
this.setIsLoading(false);
|
||||||
@ -298,7 +298,12 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
initPlugin = (plugin: TAPIPlugin, callback?: (plugin: TPlugin) => void) => {
|
initPlugin = (
|
||||||
|
plugin: TAPIPlugin,
|
||||||
|
callback?: (plugin: TPlugin) => void,
|
||||||
|
fromList?: boolean,
|
||||||
|
) => {
|
||||||
|
if (!plugin.enabled && !fromList) return;
|
||||||
const onLoad = async () => {
|
const onLoad = async () => {
|
||||||
const iWindow = this.pluginFrame?.contentWindow as IframeWindow;
|
const iWindow = this.pluginFrame?.contentWindow as IframeWindow;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user