- Move components/ to src/ and compile to dist/ with tsc - Add root barrel export plus deep-import subpath exports and base.css export - Post-compile step: copy base.css, add .js import extensions, mark client modules - Add publish.sh and .npmrc for the Gitea npm registry - Fix type errors, guard TinyMCE env access, drop ace-builds type dependency - Rename clashing props type names, remove Next.js scaffolding and unused deps Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
738 B
TypeScript
23 lines
738 B
TypeScript
const FALLBACK_BASE_URL = "https://www.datasquirel.com/tinymce-public";
|
|
|
|
/**
|
|
* Resolves the TinyMCE base URL from public env vars. Each lookup is wrapped
|
|
* in try/catch rather than a `typeof process` check: bundlers inline the full
|
|
* `process.env.X` expression, so the global `process` may still be undefined
|
|
* in the browser even when the value is available.
|
|
*/
|
|
export default function getTinyMCEDefaultBaseUrl(): string {
|
|
let nextUrl: string | undefined;
|
|
let bunextUrl: string | undefined;
|
|
|
|
try {
|
|
nextUrl = process.env.NEXT_PUBLIC_TINYMCE_BASE_URL;
|
|
} catch {}
|
|
|
|
try {
|
|
bunextUrl = process.env.BUNEXT_PUBLIC_TINYMCE_BASE_URL;
|
|
} catch {}
|
|
|
|
return nextUrl || bunextUrl || FALLBACK_BASE_URL;
|
|
}
|