mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
300a60aa45
commit
18071638cf
3 changed files with 9 additions and 17 deletions
|
|
@ -102,21 +102,23 @@ export const initUI = (protyle: IProtyle) => {
|
|||
}, {passive: false});
|
||||
};
|
||||
|
||||
export const addLoading = (protyle: IProtyle) => {
|
||||
export const addLoading = (protyle: IProtyle, msg?: string) => {
|
||||
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>');
|
||||
protyle.element.insertAdjacentHTML("beforeend", `<div style="background-color: var(--b3-theme-background);flex-direction: column;" class="fn__loading wysiwygLoading">
|
||||
<img width="48px" src="/stage/loading-pure.svg">
|
||||
<div style="color: var(--b3-theme-on-surface);margin-top: 8px;">${msg || ""}</div>
|
||||
</div>`);
|
||||
}
|
||||
}, Constants.TIMEOUT_LOAD);
|
||||
};
|
||||
|
||||
export const removeLoading = (protyle: IProtyle) => {
|
||||
protyle.element.setAttribute("data-loading", "finished");
|
||||
const loadingElement = protyle.element.querySelector(".wysiwygLoading");
|
||||
if (loadingElement) {
|
||||
loadingElement.remove();
|
||||
}
|
||||
protyle.element.querySelectorAll(".wysiwygLoading").forEach(item => {
|
||||
item.remove();
|
||||
});
|
||||
};
|
||||
|
||||
export const setPadding = (protyle: IProtyle) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue