Skip to content

Commit

Permalink
🎨 fix #8216
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 14, 2023
1 parent 300a60a commit 1807163
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
10 changes: 0 additions & 10 deletions app/src/protyle/breadcrumb/index.ts
Expand Up @@ -243,16 +243,6 @@ export class Breadcrumb {
hideElements(["toolbar"], protyle);
fetchPost("/api/format/autoSpace", {
id: protyle.block.rootID
}, () => {
/// #if MOBILE
reloadProtyle(protyle, false);
/// #else
getAllModels().editor.forEach(item => {
if (item.editor.protyle.block.rootID === protyle.block.rootID) {
reloadProtyle(item.editor.protyle, item.editor.protyle.element.isSameNode(protyle.element));
}
});
/// #endif
});
}
}).element);
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/index.ts
Expand Up @@ -96,7 +96,7 @@ export class Protyle {
break;
case "addLoadding":
if (data.data === this.protyle.block.rootID) {
addLoading(this.protyle);
addLoading(this.protyle, data.msg);
}
break;
case "transactions":
Expand Down
14 changes: 8 additions & 6 deletions app/src/protyle/ui/initUI.ts
Expand Up @@ -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) => {
Expand Down

0 comments on commit 1807163

Please sign in to comment.