Web: Doceditor: fixed render dialogs
This commit is contained in:
parent
1cdb996b62
commit
8741870f63
@ -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}`);
|
||||
// return () => {
|
||||
// console.log(`Dynamic Script Removed: ${args.url}`);
|
||||
// document.head.removeChild(element);
|
||||
};
|
||||
// };
|
||||
}, [args.url]);
|
||||
|
||||
return {
|
||||
|
@ -26,7 +26,7 @@ const withDialogs = (WrappedComponent) => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { fileInfo, fileId } = props;
|
||||
const { fileInfo, fileId, mfReady } = props;
|
||||
|
||||
const onSDKRequestSharingSettings = () => {
|
||||
setIsVisible(true);
|
||||
@ -206,8 +206,7 @@ const withDialogs = (WrappedComponent) => {
|
||||
setTitleSelectorFolder(e.target.value);
|
||||
};
|
||||
|
||||
const sharingDialog = React.useMemo(
|
||||
() => (
|
||||
const sharingDialog = mfReady && (
|
||||
<DynamicComponent
|
||||
className="dynamic-sharing-dialog"
|
||||
system={{
|
||||
@ -221,12 +220,11 @@ const withDialogs = (WrappedComponent) => {
|
||||
onCancel={onCancel}
|
||||
onSuccess={loadUsersRightsList}
|
||||
/>
|
||||
),
|
||||
[isVisible]
|
||||
);
|
||||
|
||||
const selectFileDialog = React.useMemo(
|
||||
() => (
|
||||
const fileType = fileTypeDetection();
|
||||
|
||||
const selectFileDialog = mfReady && (
|
||||
<DynamicComponent
|
||||
system={{
|
||||
scope: FILES_SCOPE,
|
||||
@ -238,16 +236,13 @@ const withDialogs = (WrappedComponent) => {
|
||||
isPanelVisible={isFileDialogVisible}
|
||||
onSelectFile={onSelectFile}
|
||||
onClose={onCloseFileDialog}
|
||||
{...fileTypeDetection()}
|
||||
{...fileType}
|
||||
titleFilesList={selectFilesListTitle()}
|
||||
headerName={t("SelectFileTitle")}
|
||||
/>
|
||||
),
|
||||
[isFileDialogVisible]
|
||||
);
|
||||
|
||||
const selectFolderDialog = React.useMemo(
|
||||
() => (
|
||||
const selectFolderDialog = mfReady && (
|
||||
<DynamicComponent
|
||||
resetTreeFolders
|
||||
showButtons
|
||||
@ -287,8 +282,6 @@ const withDialogs = (WrappedComponent) => {
|
||||
),
|
||||
})}
|
||||
/>
|
||||
),
|
||||
[openNewTab, titleSelectorFolder, isFolderDialogVisible]
|
||||
);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user