v0.2.91
This commit is contained in:
1 parent
4da41a1404
commit
5cb6960b04
31 files changed
+1611
-2123
No files matched your search
+9
-1
@@ -128,7 +128,7 @@ function settleInitialPublicAnchor(hash) {
|
||||
window.addEventListener("load", scheduleCorrection, { once: true });
|
||||
cleanups.push(() => window.removeEventListener("load", scheduleCorrection));
|
||||
}
|
||||
document.fonts?.ready?.then(scheduleCorrection).catch(() => {});
|
||||
document.fonts?.ready?.then(scheduleCorrection).catch(() => { });
|
||||
|
||||
if (typeof ResizeObserver === "function") {
|
||||
observer = new ResizeObserver(scheduleCorrection);
|
||||
@@ -183,6 +183,7 @@ function restoreFullWidth() {
|
||||
async function initialize() {
|
||||
try {
|
||||
const page = await api(`/api/public/${encodeURIComponent(token)}`, { headers: pageHeaders() });
|
||||
window.__RUSTPAD_LOADING__?.complete("access");
|
||||
if (passwordDialog.open) passwordDialog.close();
|
||||
passwordError.textContent = "";
|
||||
publicTitle.textContent = page.title;
|
||||
@@ -197,12 +198,17 @@ async function initialize() {
|
||||
installPublicPermalinks();
|
||||
alignPreviewLineNumbers(content);
|
||||
settleInitialPublicAnchor(location.hash);
|
||||
window.__RUSTPAD_LOADING__?.complete("files");
|
||||
window.__RUSTPAD_LOADING__?.ready();
|
||||
} catch (error) {
|
||||
window.__RUSTPAD_LOADING__?.complete("access");
|
||||
publicAnchorSettleCleanup?.();
|
||||
if (error.status === 401 || error.status === 403) {
|
||||
passwordError.textContent = error.status === 403 ? t("public.passwordAuthorized", {}, "Sign in with an authorized account or enter the resource password.") : t("public.passwordCorrect", {}, "Enter the correct password.");
|
||||
if (!passwordDialog.open) passwordDialog.showModal();
|
||||
passwordInput.focus();
|
||||
window.__RUSTPAD_LOADING__?.skip("files");
|
||||
window.__RUSTPAD_LOADING__?.ready();
|
||||
return;
|
||||
}
|
||||
content.replaceChildren();
|
||||
@@ -211,6 +217,8 @@ async function initialize() {
|
||||
message.textContent = String(error.message);
|
||||
content.append(message);
|
||||
toast.danger(error.message, { title: "Could not load published page" });
|
||||
window.__RUSTPAD_LOADING__?.skip("files");
|
||||
window.__RUSTPAD_LOADING__?.ready();
|
||||
}
|
||||
}
|
||||
content.addEventListener("click", async event => {
|
||||
|
||||
Reference in new issue
Block a user