From 22b4928bbd3010706736d94513d784241d281e0e Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Tue, 22 Mar 2022 13:48:04 +0300 Subject: [PATCH] Web: Doceditor: applied useToastr --- web/ASC.Web.Editor/src/Editor.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.js b/web/ASC.Web.Editor/src/Editor.js index 46234ee3a4..fda2bcaeec 100644 --- a/web/ASC.Web.Editor/src/Editor.js +++ b/web/ASC.Web.Editor/src/Editor.js @@ -5,6 +5,8 @@ import combineUrl from "@appserver/common/utils/combineUrl"; import { AppServerConfig } from "@appserver/common/constants"; import throttle from "lodash/throttle"; import Loader from "@appserver/components/loader"; +import Toast from "@appserver/components/toast"; +import { toast } from "react-toastify"; import { restoreDocumentsVersion, @@ -18,6 +20,7 @@ import { import { EditorWrapper } from "./StyledEditor"; import { useTranslation } from "react-i18next"; import useFilesUtils from "./helpers/useFilesUtils"; +import useToastr from "./helpers/useToastr"; import withDialogs from "./helpers/withDialogs"; @@ -33,6 +36,8 @@ const LoaderComponent = ( /> ); +toast.configure(); + const onSDKInfo = (event) => { console.log( "ONLYOFFICE Document Editor is opened in mode " + event.data.mode @@ -79,12 +84,12 @@ const initDesktop = (cfg) => { }) .catch((error) => { console.log(error); - // toastr.error( - // typeof error === "string" ? error : error.message, - // null, - // 0, - // true - // ); + window.toastr.error( + typeof error === "string" ? error : error.message, + null, + 0, + true + ); }); }, t @@ -126,6 +131,7 @@ function Editor({ const [documentTitle, setNewDocumentTitle] = useState("Loading..."); useFilesUtils(); + useToastr(); const { t } = useTranslation(); @@ -523,7 +529,7 @@ function Editor({ setIsLoaded(true); } catch (error) { console.log(error, "init error"); - //toastr.error(error.message, null, 0, true); + window.toastr.error(error.message, null, 0, true); } }; @@ -540,6 +546,7 @@ function Editor({ {sharingDialog} {selectFileDialog} {selectFolderDialog} + ); }