From ed30175daf03354d7a89d4f0a4bae3599a947398 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 May 2023 11:44:49 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/8158 --- app/src/protyle/ui/initUI.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts index bd9f8bd81..ecb1f863a 100644 --- a/app/src/protyle/ui/initUI.ts +++ b/app/src/protyle/ui/initUI.ts @@ -73,10 +73,16 @@ export const initUI = (protyle: IProtyle) => { }; export const addLoading = (protyle: IProtyle) => { - protyle.element.insertAdjacentHTML("beforeend", '
'); + protyle.element.removeAttribute("data-loading"); + setTimeout(() => { + if (protyle.element.getAttribute("data-loading") !== "finished") { + protyle.element.insertAdjacentHTML("beforeend", '
'); + } + }, Constants.TIMEOUT_BLOCKLOAD); }; export const removeLoading = (protyle: IProtyle) => { + protyle.element.setAttribute("data-loading", "finished"); const loadingElement = protyle.element.querySelector(".wysiwygLoading"); if (loadingElement) { loadingElement.remove();