diff --git a/web/ASC.Web.Editor/src/components/dynamic.js b/web/ASC.Web.Editor/src/components/dynamic.js index 69466277e0..d485f997ae 100644 --- a/web/ASC.Web.Editor/src/components/dynamic.js +++ b/web/ASC.Web.Editor/src/components/dynamic.js @@ -4,24 +4,20 @@ import React from "react"; // import Error520 from "studio/Error520"; // import Error404 from "studio/Error404"; -export function loadComponent(scope, module, moduleName = null) { +export function loadComponent(scope, module) { return async () => { // Initializes the share scope. This fills it with known provided modules from this build and all remotes await __webpack_init_sharing__("default"); const container = window[scope]; // or get the container somewhere else // Initialize the container, it may provide shared modules await container.init(__webpack_share_scopes__.default); - console.log(container); const factory = await window[scope].get(module); const Module = factory(); - if (moduleName) - window[moduleName] = - moduleName === "filesUtils" ? Module : Module.default; return Module; }; } -const useDynamicScript = (args) => { +export const useDynamicScript = (args) => { const [ready, setReady] = React.useState(false); const [failed, setFailed] = React.useState(false); @@ -29,6 +25,7 @@ const useDynamicScript = (args) => { if (!args.url) { return; } + const exists = document.getElementById(args.id); if (exists) { @@ -61,10 +58,10 @@ const useDynamicScript = (args) => { document.head.appendChild(element); //TODO: Comment if you don't want to remove loaded remoteEntry - return () => { - console.log(`Dynamic Script Removed: ${args.url}`); - // document.head.removeChild(element); - }; + // return () => { + // console.log(`Dynamic Script Removed: ${args.url}`); + // document.head.removeChild(element); + // }; }, [args.url]); return { diff --git a/web/ASC.Web.Editor/src/helpers/withDialogs.js b/web/ASC.Web.Editor/src/helpers/withDialogs.js index 6d51abb5e2..b67e6d135d 100644 --- a/web/ASC.Web.Editor/src/helpers/withDialogs.js +++ b/web/ASC.Web.Editor/src/helpers/withDialogs.js @@ -26,7 +26,7 @@ const withDialogs = (WrappedComponent) => { const { t } = useTranslation(); - const { fileInfo, fileId } = props; + const { fileInfo, fileId, mfReady } = props; const onSDKRequestSharingSettings = () => { setIsVisible(true); @@ -206,89 +206,82 @@ const withDialogs = (WrappedComponent) => { setTitleSelectorFolder(e.target.value); }; - const sharingDialog = React.useMemo( - () => ( - - ), - [isVisible] + const sharingDialog = mfReady && ( + ); - const selectFileDialog = React.useMemo( - () => ( - - ), - [isFileDialogVisible] + const fileType = fileTypeDetection(); + + const selectFileDialog = mfReady && ( + ); - const selectFolderDialog = React.useMemo( - () => ( - + {t("FileName")} + + + } + {...(extension !== "fb2" && { + footer: ( - {t("FileName")} - - } - {...(extension !== "fb2" && { - footer: ( - - - - ), - })} - /> - ), - [openNewTab, titleSelectorFolder, isFolderDialogVisible] + ), + })} + /> ); return (