Web: Doceditor: applied useToastr

This commit is contained in:
Artem Tarasov 2022-03-22 13:48:04 +03:00
parent 12e54ea069
commit 22b4928bbd

View File

@ -5,6 +5,8 @@ import combineUrl from "@appserver/common/utils/combineUrl";
import { AppServerConfig } from "@appserver/common/constants"; import { AppServerConfig } from "@appserver/common/constants";
import throttle from "lodash/throttle"; import throttle from "lodash/throttle";
import Loader from "@appserver/components/loader"; import Loader from "@appserver/components/loader";
import Toast from "@appserver/components/toast";
import { toast } from "react-toastify";
import { import {
restoreDocumentsVersion, restoreDocumentsVersion,
@ -18,6 +20,7 @@ import {
import { EditorWrapper } from "./StyledEditor"; import { EditorWrapper } from "./StyledEditor";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import useFilesUtils from "./helpers/useFilesUtils"; import useFilesUtils from "./helpers/useFilesUtils";
import useToastr from "./helpers/useToastr";
import withDialogs from "./helpers/withDialogs"; import withDialogs from "./helpers/withDialogs";
@ -33,6 +36,8 @@ const LoaderComponent = (
/> />
); );
toast.configure();
const onSDKInfo = (event) => { const onSDKInfo = (event) => {
console.log( console.log(
"ONLYOFFICE Document Editor is opened in mode " + event.data.mode "ONLYOFFICE Document Editor is opened in mode " + event.data.mode
@ -79,12 +84,12 @@ const initDesktop = (cfg) => {
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
// toastr.error( window.toastr.error(
// typeof error === "string" ? error : error.message, typeof error === "string" ? error : error.message,
// null, null,
// 0, 0,
// true true
// ); );
}); });
}, },
t t
@ -126,6 +131,7 @@ function Editor({
const [documentTitle, setNewDocumentTitle] = useState("Loading..."); const [documentTitle, setNewDocumentTitle] = useState("Loading...");
useFilesUtils(); useFilesUtils();
useToastr();
const { t } = useTranslation(); const { t } = useTranslation();
@ -523,7 +529,7 @@ function Editor({
setIsLoaded(true); setIsLoaded(true);
} catch (error) { } catch (error) {
console.log(error, "init 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} {sharingDialog}
{selectFileDialog} {selectFileDialog}
{selectFolderDialog} {selectFolderDialog}
<Toast />
</EditorWrapper> </EditorWrapper>
); );
} }