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 Editor from "./components/Editor.js";
import { useSSR } from "react-i18next"; import { useSSR } from "react-i18next";
import useMfScripts from "./helpers/useMfScripts"; 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 { combineUrl } from "@docspace/shared/utils/combineUrl";
import { getCookie, setCookie } from "@docspace/shared/utils/cookie"; import { getCookie, setCookie } from "@docspace/shared/utils/cookie";
@ -40,7 +40,8 @@ const App = ({
switch (rest?.config?.documentType) { switch (rest?.config?.documentType) {
case "word": case "word":
icon = rest?.config?.document?.fileType === "pdf" ? PDFIcoUrl : TextIcoUrl; icon =
rest?.config?.document?.fileType === "pdf" ? PDFIcoUrl : TextIcoUrl;
break; break;
case "slide": case "slide":
icon = PresentationIcoUrl; icon = PresentationIcoUrl;
@ -80,6 +81,8 @@ const App = ({
(isLoadingDocumentError || isLoadedDocument) (isLoadingDocumentError || isLoadedDocument)
) )
tempElm.outerHTML = ""; tempElm.outerHTML = "";
if (isLoadingDocumentError) frameCallCommand("setIsLoaded");
} }
if (isRetina() && getCookie("is_retina") == null) { if (isRetina() && getCookie("is_retina") == null) {

View File

@ -23,7 +23,11 @@ import {
import { EditorWrapper } from "../components/StyledEditor"; import { EditorWrapper } from "../components/StyledEditor";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import withDialogs from "../helpers/withDialogs"; 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 { getEditorTheme } from "@docspace/shared/utils";
import { toastr } from "@docspace/shared/components/toast"; import { toastr } from "@docspace/shared/components/toast";
import { DocumentEditor } from "@onlyoffice/document-editor-react"; import { DocumentEditor } from "@onlyoffice/document-editor-react";
@ -40,6 +44,7 @@ const onSDKInfo = (event) => {
}; };
const onSDKWarning = (event) => { const onSDKWarning = (event) => {
frameCallCommand("setIsLoaded");
console.log( console.log(
"ONLYOFFICE Document Editor reports a warning: code " + "ONLYOFFICE Document Editor reports a warning: code " +
event.data.warningCode + event.data.warningCode +
@ -49,6 +54,7 @@ const onSDKWarning = (event) => {
}; };
const onSDKError = (event) => { const onSDKError = (event) => {
frameCallCommand("setIsLoaded");
console.log( console.log(
"ONLYOFFICE Document Editor reports an error: code " + "ONLYOFFICE Document Editor reports an error: code " +
event.data.errorCode + event.data.errorCode +
@ -565,14 +571,14 @@ function Editor({
console.log("onDocumentReady", arguments, { docEditor }); console.log("onDocumentReady", arguments, { docEditor });
documentIsReady = true; documentIsReady = true;
frameCallCommand("setIsLoaded");
config?.errorMessage && docEditor?.showMessage(config.errorMessage); config?.errorMessage && docEditor?.showMessage(config.errorMessage);
if (isSharingAccess) { if (isSharingAccess) {
loadUsersRightsList(docEditor); loadUsersRightsList(docEditor);
} }
frameCallCommand("setIsLoaded");
assign(window, ["ASC", "Files", "Editor", "docEditor"], docEditor); //Do not remove: it's for Back button on Mobile App assign(window, ["ASC", "Files", "Editor", "docEditor"], docEditor); //Do not remove: it's for Back button on Mobile App
}; };