Emdash source with visual editor image upload fix
Fixes: 1. media.ts: wrap placeholder generation in try-catch 2. toolbar.ts: check r.ok, display error message in popover
This commit is contained in:
98
packages/core/src/astro/routes/admin.astro
Normal file
98
packages/core/src/astro/routes/admin.astro
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
/**
|
||||
* Admin shell route - injected by EmDash integration
|
||||
*
|
||||
* This page serves the EmDash admin React SPA.
|
||||
* AdminWrapper imports plugin admin modules and passes them to AdminApp.
|
||||
*/
|
||||
import "@emdash-cms/admin/styles.css";
|
||||
// Use package-qualified import so Astro generates a proper module URL
|
||||
// (relative imports resolve to absolute paths which break client hydration)
|
||||
import AdminWrapper from "emdash/routes/PluginRegistry";
|
||||
import { Font } from "astro:assets";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
import { resolveLocale, loadMessages, getLocaleDir } from "@emdash-cms/admin/locales";
|
||||
|
||||
const resolvedLocale = resolveLocale(Astro.request);
|
||||
const resolvedDir = getLocaleDir(resolvedLocale);
|
||||
const messages = await loadMessages(resolvedLocale);
|
||||
|
||||
const adminConfig = Astro.locals.emdash?.config?.admin;
|
||||
const pageTitle = adminConfig?.siteName ? `${adminConfig.siteName} Admin` : "EmDash Admin";
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang={resolvedLocale} dir={resolvedDir}>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<Font cssVariable="--font-emdash" />
|
||||
{adminConfig?.favicon ? (
|
||||
<link rel="icon" href={adminConfig.favicon} />
|
||||
) : (
|
||||
<link
|
||||
rel="icon"
|
||||
href="data:image/svg+xml,<svg width='75' height='75' viewBox='0 0 75 75' fill='none' xmlns='http://www.w3.org/2000/svg'> <g clip-path='url(%23clip0_50_99)'> <rect x='3' y='3' width='69' height='69' rx='10.518' stroke='url(%23paint0_linear_50_99)' stroke-width='6'/> <rect x='18' y='34' width='39.3661' height='6.56101' fill='url(%23paint1_linear_50_99)'/> </g> <defs> <linearGradient id='paint0_linear_50_99' x1='-42.9996' y1='124' x2='92.4233' y2='-41.7456' gradientUnits='userSpaceOnUse'> <stop stop-color='%230F006B'/> <stop offset='0.0833333' stop-color='%23281A81'/> <stop offset='0.166667' stop-color='%235D0C83'/> <stop offset='0.25' stop-color='%23911475'/> <stop offset='0.333333' stop-color='%23CE2F55'/> <stop offset='0.416667' stop-color='%23FF6633'/> <stop offset='0.5' stop-color='%23F6821F'/> <stop offset='0.583333' stop-color='%23FBAD41'/> <stop offset='0.666667' stop-color='%23FFCD89'/> <stop offset='0.75' stop-color='%23FFE9CB'/> <stop offset='0.833333' stop-color='%23FFF7EC'/> <stop offset='0.916667' stop-color='%23FFF8EE'/> <stop offset='1' stop-color='white'/> </linearGradient> <linearGradient id='paint1_linear_50_99' x1='91.4992' y1='27.4982' x2='28.1217' y2='54.1775' gradientUnits='userSpaceOnUse'> <stop stop-color='white'/> <stop offset='0.129253' stop-color='%23FFF8EE'/> <stop offset='0.617058' stop-color='%23FBAD41'/> <stop offset='0.848019' stop-color='%23F6821F'/> <stop offset='1' stop-color='%23FF6633'/> </linearGradient> <clipPath id='clip0_50_99'> <rect width='75' height='75' fill='white'/> </clipPath> </defs> </svg>"
|
||||
/>
|
||||
)}
|
||||
<title>{pageTitle}</title>
|
||||
</head>
|
||||
<body class="isolate">
|
||||
<div id="admin-root" class="min-h-screen">
|
||||
<div id="emdash-boot-loader">
|
||||
<style>
|
||||
#emdash-boot-loader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
color-scheme: light dark;
|
||||
background: light-dark(hsl(0 0% 100%), hsl(222.2 84% 4.9%));
|
||||
}
|
||||
#emdash-boot-loader .loader-inner {
|
||||
text-align: center;
|
||||
}
|
||||
#emdash-boot-loader .spinner {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 0 auto;
|
||||
border: 2.5px solid
|
||||
light-dark(
|
||||
hsl(215.4 16.3% 46.9% / 0.3),
|
||||
hsl(215 20.2% 65.1% / 0.3)
|
||||
);
|
||||
border-top-color: light-dark(
|
||||
hsl(215.4 16.3% 46.9%),
|
||||
hsl(215 20.2% 65.1%)
|
||||
);
|
||||
border-radius: 50%;
|
||||
animation: emdash-spin 0.8s linear infinite;
|
||||
}
|
||||
#emdash-boot-loader p {
|
||||
margin-top: 1rem;
|
||||
font-family: var(
|
||||
--font-emdash,
|
||||
ui-sans-serif,
|
||||
system-ui,
|
||||
sans-serif
|
||||
);
|
||||
font-size: 0.875rem;
|
||||
color: light-dark(hsl(215.4 16.3% 46.9%), hsl(215 20.2% 65.1%));
|
||||
}
|
||||
@keyframes emdash-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="loader-inner">
|
||||
<div class="spinner"></div>
|
||||
<p>{adminConfig?.siteName ? `Loading ${adminConfig.siteName}...` : "Loading EmDash..."}</p>
|
||||
</div>
|
||||
</div>
|
||||
<AdminWrapper client:only="react" locale={resolvedLocale} messages={messages} />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user