0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/lib/mobiledoc/cards/image.js
Kevin Ansfield 7548ace32d Koenig - Output captions for image and embed cards
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
2018-03-14 18:21:30 +00:00

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;
}
};