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 Error520 from "studio/Error520";
|
||||||
// import Error404 from "studio/Error404";
|
// import Error404 from "studio/Error404";
|
||||||
|
|
||||||
export function loadComponent(scope, module, moduleName = null) {
|
export function loadComponent(scope, module) {
|
||||||
return async () => {
|
return async () => {
|
||||||
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
||||||
await __webpack_init_sharing__("default");
|
await __webpack_init_sharing__("default");
|
||||||
const container = window[scope]; // or get the container somewhere else
|
const container = window[scope]; // or get the container somewhere else
|
||||||
// Initialize the container, it may provide shared modules
|
// Initialize the container, it may provide shared modules
|
||||||
await container.init(__webpack_share_scopes__.default);
|
await container.init(__webpack_share_scopes__.default);
|
||||||
console.log(container);
|
|
||||||
const factory = await window[scope].get(module);
|
const factory = await window[scope].get(module);
|
||||||
const Module = factory();
|
const Module = factory();
|
||||||
if (moduleName)
|
|
||||||
window[moduleName] =
|
|
||||||
moduleName === "filesUtils" ? Module : Module.default;
|
|
||||||
return Module;
|
return Module;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const useDynamicScript = (args) => {
|
export const useDynamicScript = (args) => {
|
||||||
const [ready, setReady] = React.useState(false);
|
const [ready, setReady] = React.useState(false);
|
||||||
const [failed, setFailed] = React.useState(false);
|
const [failed, setFailed] = React.useState(false);
|
||||||
|
|
||||||
@ -29,6 +25,7 @@ const useDynamicScript = (args) => {
|
|||||||
if (!args.url) {
|
if (!args.url) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exists = document.getElementById(args.id);
|
const exists = document.getElementById(args.id);
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
@ -61,10 +58,10 @@ const useDynamicScript = (args) => {
|
|||||||
document.head.appendChild(element);
|
document.head.appendChild(element);
|
||||||
|
|
||||||
//TODO: Comment if you don't want to remove loaded remoteEntry
|
//TODO: Comment if you don't want to remove loaded remoteEntry
|
||||||
return () => {
|
// return () => {
|
||||||
console.log(`Dynamic Script Removed: ${args.url}`);
|
// console.log(`Dynamic Script Removed: ${args.url}`);
|
||||||
// document.head.removeChild(element);
|
// document.head.removeChild(element);
|
||||||
};
|
// };
|
||||||
}, [args.url]);
|
}, [args.url]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -26,7 +26,7 @@ const withDialogs = (WrappedComponent) => {
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { fileInfo, fileId } = props;
|
const { fileInfo, fileId, mfReady } = props;
|
||||||
|
|
||||||
const onSDKRequestSharingSettings = () => {
|
const onSDKRequestSharingSettings = () => {
|
||||||
setIsVisible(true);
|
setIsVisible(true);
|
||||||
@ -206,8 +206,7 @@ const withDialogs = (WrappedComponent) => {
|
|||||||
setTitleSelectorFolder(e.target.value);
|
setTitleSelectorFolder(e.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const sharingDialog = React.useMemo(
|
const sharingDialog = mfReady && (
|
||||||
() => (
|
|
||||||
<DynamicComponent
|
<DynamicComponent
|
||||||
className="dynamic-sharing-dialog"
|
className="dynamic-sharing-dialog"
|
||||||
system={{
|
system={{
|
||||||
@ -221,12 +220,11 @@ const withDialogs = (WrappedComponent) => {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
onSuccess={loadUsersRightsList}
|
onSuccess={loadUsersRightsList}
|
||||||
/>
|
/>
|
||||||
),
|
|
||||||
[isVisible]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectFileDialog = React.useMemo(
|
const fileType = fileTypeDetection();
|
||||||
() => (
|
|
||||||
|
const selectFileDialog = mfReady && (
|
||||||
<DynamicComponent
|
<DynamicComponent
|
||||||
system={{
|
system={{
|
||||||
scope: FILES_SCOPE,
|
scope: FILES_SCOPE,
|
||||||
@ -238,16 +236,13 @@ const withDialogs = (WrappedComponent) => {
|
|||||||
isPanelVisible={isFileDialogVisible}
|
isPanelVisible={isFileDialogVisible}
|
||||||
onSelectFile={onSelectFile}
|
onSelectFile={onSelectFile}
|
||||||
onClose={onCloseFileDialog}
|
onClose={onCloseFileDialog}
|
||||||
{...fileTypeDetection()}
|
{...fileType}
|
||||||
titleFilesList={selectFilesListTitle()}
|
titleFilesList={selectFilesListTitle()}
|
||||||
headerName={t("SelectFileTitle")}
|
headerName={t("SelectFileTitle")}
|
||||||
/>
|
/>
|
||||||
),
|
|
||||||
[isFileDialogVisible]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const selectFolderDialog = React.useMemo(
|
const selectFolderDialog = mfReady && (
|
||||||
() => (
|
|
||||||
<DynamicComponent
|
<DynamicComponent
|
||||||
resetTreeFolders
|
resetTreeFolders
|
||||||
showButtons
|
showButtons
|
||||||
@ -287,8 +282,6 @@ const withDialogs = (WrappedComponent) => {
|
|||||||
),
|
),
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
),
|
|
||||||
[openNewTab, titleSelectorFolder, isFolderDialogVisible]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user