diff --git a/src/frontend/plugins/edusharing-asset/renderer.tsx b/src/frontend/plugins/edusharing-asset/renderer.tsx index 411de9c7..cdae8534 100644 --- a/src/frontend/plugins/edusharing-asset/renderer.tsx +++ b/src/frontend/plugins/edusharing-asset/renderer.tsx @@ -16,8 +16,6 @@ export function EdusharingAssetRenderer(props: { ltik: string contentWidth: string | null }) { - // Use default value for widthInPercent so that old content can be load - // where this property was not set const { nodeId, repositoryId, ltik, contentWidth } = props let [embedHtml, setEmbedHtml] = useState(null) @@ -107,6 +105,34 @@ export function EdusharingAssetRenderer(props: { const parser = new DOMParser() const htmlDocument = parser.parseFromString(detailsSnippet, 'text/html') + // Sadly, LearningApps also have `mediatype: 'link'` so we need to check more stuff here than just `mediatype` + const isLink = + content.node.mediatype === 'link' && + !content.node.mimetype && + content.node.repositoryType === 'ALFRESCO' + if (isLink) { + const linkElement = htmlDocument.querySelector( + '.edusharing_rendering_content_footer a', + ) + if (!linkElement) { + return { + html: '
Fehler beim Einbinden des Inhalts
', + renderMethod: 'dangerously-set-inner-html', + defineContainerHeight: false, + } + } + + return { + html: `${ + linkElement.innerText ? linkElement.innerText : linkElement.href + }`, + renderMethod: 'dangerously-set-inner-html', + defineContainerHeight: false, + } + } + const image = getImageOrUndefined(htmlDocument) const isPixabayImage =