mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
refs https://github.com/TryGhost/Ghost/issues/9311 - very basic implementation, still needs proper classes and default stylesheet implementation - change image card output to a `<figure>` with optional `<figcaption>` - add optional `<p>` caption output to the html card
22 lines
575 B
JavaScript
22 lines
575 B
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
name: 'image',
|
|
type: 'dom',
|
|
render({payload, env: {dom}}) {
|
|
let figure = dom.createElement('figure');
|
|
|
|
let img = dom.createElement('img');
|
|
img.className = 'kg-card-image';
|
|
img.setAttribute('src', payload.src);
|
|
figure.appendChild(img);
|
|
|
|
if (payload.caption) {
|
|
let figcaption = dom.createElement('figcaption');
|
|
figcaption.appendChild(dom.createTextNode(payload.caption));
|
|
figure.appendChild(figcaption);
|
|
}
|
|
|
|
return figure;
|
|
}
|
|
};
|