Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: add loading to preview

Vanessa171aaf5372ea
diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts
index 9bffe70671..9eb4bcfc99 100644
--- a/app/src/protyle/preview/index.ts
+++ b/app/src/protyle/preview/index.ts
@@ -155,7 +155,13 @@ export class Preview {
if (this.element.style.display === "none") {
return;
}
-
+ let loadingElement = this.element.querySelector(".fn__loading");
+ if (!loadingElement) {
+ this.element.insertAdjacentHTML("beforeend", `<div style="flex-direction: column;" class="fn__loading">
+ <img width="48px" src="/stage/loading-pure.svg">
+</div>`);
+ loadingElement = this.element.querySelector(".fn__loading");
+ }
this.mdTimeoutId = window.setTimeout(() => {
fetchPost("/api/export/preview", {
id: protyle.block.parentID || protyle.options.blockId,
@@ -183,6 +189,7 @@ export class Preview {
}
});
/// #endif
+ loadingElement.remove();
});
}, protyle.options.preview.delay);
}