This commit is contained in:
Vanessa 2023-05-14 12:09:52 +08:00
parent 300a60aa45
commit 18071638cf
3 changed files with 9 additions and 17 deletions

View file

@ -243,16 +243,6 @@ export class Breadcrumb {
hideElements(["toolbar"], protyle); hideElements(["toolbar"], protyle);
fetchPost("/api/format/autoSpace", { fetchPost("/api/format/autoSpace", {
id: protyle.block.rootID 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); }).element);

View file

@ -96,7 +96,7 @@ export class Protyle {
break; break;
case "addLoadding": case "addLoadding":
if (data.data === this.protyle.block.rootID) { if (data.data === this.protyle.block.rootID) {
addLoading(this.protyle); addLoading(this.protyle, data.msg);
} }
break; break;
case "transactions": case "transactions":

View file

@ -102,21 +102,23 @@ export const initUI = (protyle: IProtyle) => {
}, {passive: false}); }, {passive: false});
}; };
export const addLoading = (protyle: IProtyle) => { export const addLoading = (protyle: IProtyle, msg?: string) => {
protyle.element.removeAttribute("data-loading"); protyle.element.removeAttribute("data-loading");
setTimeout(() => { setTimeout(() => {
if (protyle.element.getAttribute("data-loading") !== "finished") { 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); }, Constants.TIMEOUT_LOAD);
}; };
export const removeLoading = (protyle: IProtyle) => { export const removeLoading = (protyle: IProtyle) => {
protyle.element.setAttribute("data-loading", "finished"); protyle.element.setAttribute("data-loading", "finished");
const loadingElement = protyle.element.querySelector(".wysiwygLoading"); protyle.element.querySelectorAll(".wysiwygLoading").forEach(item => {
if (loadingElement) { item.remove();
loadingElement.remove(); });
}
}; };
export const setPadding = (protyle: IProtyle) => { export const setPadding = (protyle: IProtyle) => {