Web: Doceditor: added useToastr
This commit is contained in:
parent
851de4f062
commit
12e54ea069
@ -1,2 +1,4 @@
|
|||||||
export const FILES_SCOPE = "files";
|
export const FILES_SCOPE = "files";
|
||||||
export const FILES_REMOTE_ENTRY_URL = "/products/files/remoteEntry.js";
|
export const FILES_REMOTE_ENTRY_URL = "/products/files/remoteEntry.js";
|
||||||
|
export const STUDIO_SCOPE = "studio";
|
||||||
|
export const STUDIO_REMOTE_ENTRY_URL = "/remoteEntry.js";
|
||||||
|
19
web/ASC.Web.Editor/src/helpers/useToastr.js
Normal file
19
web/ASC.Web.Editor/src/helpers/useToastr.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { loadComponent } from "../components/dynamic";
|
||||||
|
import { STUDIO_SCOPE } from "../helpers/constants";
|
||||||
|
|
||||||
|
function useFilesUtils() {
|
||||||
|
const [isInitialized, setIsInitialized] = React.useState(false);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!isInitialized) {
|
||||||
|
const exists = document.getElementById(STUDIO_SCOPE);
|
||||||
|
if (exists) {
|
||||||
|
loadComponent(STUDIO_SCOPE, "./toastr", "toastr")();
|
||||||
|
setIsInitialized(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useFilesUtils;
|
Loading…
Reference in New Issue
Block a user