This commit is contained in:
Vanessa 2023-05-03 11:44:49 +08:00
parent 6f65247cc8
commit ed30175daf

View file

@ -73,10 +73,16 @@ export const initUI = (protyle: IProtyle) => {
}; };
export const addLoading = (protyle: IProtyle) => { export const addLoading = (protyle: IProtyle) => {
protyle.element.insertAdjacentHTML("beforeend", '<div style="background-color: var(--b3-theme-background)" class="fn__loading wysiwygLoading"><img width="48px" src="/stage/loading-pure.svg"></div>'); protyle.element.removeAttribute("data-loading");
setTimeout(() => {
if (protyle.element.getAttribute("data-loading") !== "finished") {
protyle.element.insertAdjacentHTML("beforeend", '<div style="background-color: var(--b3-theme-background)" class="fn__loading wysiwygLoading"><img width="48px" src="/stage/loading-pure.svg"></div>');
}
}, Constants.TIMEOUT_BLOCKLOAD);
}; };
export const removeLoading = (protyle: IProtyle) => { export const removeLoading = (protyle: IProtyle) => {
protyle.element.setAttribute("data-loading", "finished");
const loadingElement = protyle.element.querySelector(".wysiwygLoading"); const loadingElement = protyle.element.querySelector(".wysiwygLoading");
if (loadingElement) { if (loadingElement) {
loadingElement.remove(); loadingElement.remove();