Web: Doceditor: added useToastr

This commit is contained in:
Artem Tarasov 2022-03-22 13:47:32 +03:00
parent 851de4f062
commit 12e54ea069
2 changed files with 21 additions and 0 deletions

View File

@ -1,2 +1,4 @@
export const FILES_SCOPE = "files";
export const FILES_REMOTE_ENTRY_URL = "/products/files/remoteEntry.js";
export const STUDIO_SCOPE = "studio";
export const STUDIO_REMOTE_ENTRY_URL = "/remoteEntry.js";

View 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;