~mariusor/oni

04d934a63ff685bd7de7152939a1d31c4d48c4e0 — Marius Orcsik a month ago 074c818 master
Improve image element render
1 files changed, 4 insertions(+), 7 deletions(-)

M src/js/activity-pub-object.jsx
M src/js/activity-pub-object.jsx => src/js/activity-pub-object.jsx +4 -7
@@ 298,17 298,14 @@ export class ActivityPubObject extends LitElement {
}

ActivityPubObject.renderByMediaType = function (it, inline) {
    if (it == null || !it.hasOwnProperty('mediaType')) {
    if (!it?.hasOwnProperty('mediaType')) {
        return nothing;
    }

    switch (it.mediaType) {
        case 'image/png':
        case 'image/jpeg':
            return html`<oni-image it=${JSON.stringify(it)} ?inline=${inline}></oni-image>`;
        default:
            return html`<a href=${it.url}>${it.name}</a>`;
    if (it.mediaType.indexOf('image/') === 0) {
        return html`<oni-image it=${JSON.stringify(it)} ?inline=${inline}></oni-image>`;
    }
    return html`<a href=${it.url}>${it.name}</a>`;
}

ActivityPubObject.renderByType = function (it, showMetadata) {