diff --git a/ghost/admin/app/components/koenig-lexical-editor.js b/ghost/admin/app/components/koenig-lexical-editor.js index a26f0dbda6..88262ea871 100644 --- a/ghost/admin/app/components/koenig-lexical-editor.js +++ b/ghost/admin/app/components/koenig-lexical-editor.js @@ -147,6 +147,17 @@ export default class KoenigLexicalEditor extends Component { } ReactComponent = (props) => { + const fetchEmbed = async (url) => { + let oembedEndpoint = this.ghostPaths.url.api('oembed'); + let response = await this.ajax.request(oembedEndpoint, { + data: {url, type: 'bookmark'} + }); + if (!response.metadata) { + throw 'No metadata returned'; + } + return response; + }; + const defaultCardConfig = { unsplash: { defaultHeaders: { @@ -157,7 +168,8 @@ export default class KoenigLexicalEditor extends Component { 'X-Unsplash-Cache': true } }, - tenor: this.config.tenor?.googleApiKey ? this.config.tenor : null + tenor: this.config.tenor?.googleApiKey ? this.config.tenor : null, + fetchEmbed: fetchEmbed }; const cardConfig = Object.assign({}, defaultCardConfig, props.cardConfig);