diff --git a/packages/editor/src/client/App.js b/packages/editor/src/client/App.js index 7929710bd4..577cf686f8 100644 --- a/packages/editor/src/client/App.js +++ b/packages/editor/src/client/App.js @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import Editor from "./components/Editor.js"; import { useSSR } from "react-i18next"; import useMfScripts from "./helpers/useMfScripts"; -import { isRetina } from "@docspace/shared/utils/common"; +import { isRetina, frameCallCommand } from "@docspace/shared/utils/common"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import { getCookie, setCookie } from "@docspace/shared/utils/cookie"; @@ -40,7 +40,8 @@ const App = ({ switch (rest?.config?.documentType) { case "word": - icon = rest?.config?.document?.fileType === "pdf" ? PDFIcoUrl : TextIcoUrl; + icon = + rest?.config?.document?.fileType === "pdf" ? PDFIcoUrl : TextIcoUrl; break; case "slide": icon = PresentationIcoUrl; @@ -80,6 +81,8 @@ const App = ({ (isLoadingDocumentError || isLoadedDocument) ) tempElm.outerHTML = ""; + + if (isLoadingDocumentError) frameCallCommand("setIsLoaded"); } if (isRetina() && getCookie("is_retina") == null) { diff --git a/packages/editor/src/client/components/Editor.js b/packages/editor/src/client/components/Editor.js index 81d4cbed49..b0ef2e2428 100644 --- a/packages/editor/src/client/components/Editor.js +++ b/packages/editor/src/client/components/Editor.js @@ -23,7 +23,11 @@ import { import { EditorWrapper } from "../components/StyledEditor"; import { useTranslation } from "react-i18next"; import withDialogs from "../helpers/withDialogs"; -import { assign, frameCallEvent, frameCallCommand } from "@docspace/shared/utils/common"; +import { + assign, + frameCallEvent, + frameCallCommand, +} from "@docspace/shared/utils/common"; import { getEditorTheme } from "@docspace/shared/utils"; import { toastr } from "@docspace/shared/components/toast"; import { DocumentEditor } from "@onlyoffice/document-editor-react"; @@ -40,6 +44,7 @@ const onSDKInfo = (event) => { }; const onSDKWarning = (event) => { + frameCallCommand("setIsLoaded"); console.log( "ONLYOFFICE Document Editor reports a warning: code " + event.data.warningCode + @@ -49,6 +54,7 @@ const onSDKWarning = (event) => { }; const onSDKError = (event) => { + frameCallCommand("setIsLoaded"); console.log( "ONLYOFFICE Document Editor reports an error: code " + event.data.errorCode + @@ -272,10 +278,10 @@ function Editor({ documentType === "word" ? "docx" : documentType === "slide" - ? "pptx" - : documentType === "cell" - ? "xlsx" - : "docxf"; + ? "pptx" + : documentType === "cell" + ? "xlsx" + : "docxf"; let fileName = t("Common:NewDocument"); @@ -565,14 +571,14 @@ function Editor({ console.log("onDocumentReady", arguments, { docEditor }); documentIsReady = true; + frameCallCommand("setIsLoaded"); + config?.errorMessage && docEditor?.showMessage(config.errorMessage); if (isSharingAccess) { loadUsersRightsList(docEditor); } - frameCallCommand("setIsLoaded"); - assign(window, ["ASC", "Files", "Editor", "docEditor"], docEditor); //Do not remove: it's for Back button on Mobile App };