mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
639be25f1d
refs https://github.com/TryGhost/DevOps/issues/83 - this will now continue use the dev server assets if we tell it to, or copy the dependency package files to the built folder otherwise - removes `editor` from config API because it's no longer needed - removes dependency on `editor.url` in tests, as this no longer exists - edits dev script to pass dev server URL as env var - adds `@tryghost/koenig-lexical` dependency to Admin
23 lines
884 B
JavaScript
23 lines
884 B
JavaScript
import config from 'ghost-admin/config/environment';
|
|
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
|
|
|
export default async function fetchKoenigLexical() {
|
|
if (window['@tryghost/koenig-lexical']) {
|
|
return window['@tryghost/koenig-lexical'];
|
|
}
|
|
|
|
// If we pass an editor URL (the env var from the dev script), use that
|
|
// Else, if we pass a CDN URL, use that
|
|
// Else, use the asset root from the ghostPaths util
|
|
const baseUrl = (config.editorUrl || (config.cdnUrl ? `${config.cdnUrl}assets/koenig-lexical/` : `${ghostPaths().assetRootWithHost}koenig-lexical/`));
|
|
const url = new URL(`${baseUrl}koenig-lexical.umd.js`);
|
|
|
|
if (url.protocol === 'http:') {
|
|
await import(`http://${url.host}${url.pathname}`);
|
|
} else {
|
|
await import(`https://${url.host}${url.pathname}`);
|
|
}
|
|
|
|
return window['@tryghost/koenig-lexical'];
|
|
}
|