Merge branch 'feature/js-sdk-presets' of https://github.com/ONLYOFFICE/DocSpace-client into feature/js-sdk-presets

This commit is contained in:
Vladimir Khvan 2024-02-12 16:37:35 +05:00
commit 68f55b4487
2 changed files with 18 additions and 9 deletions

View File

@ -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) {

View File

@ -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 +
@ -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
};