0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Koenig - Add caption to HTML/embed card

refs https://github.com/TryGhost/Ghost/issues/9311
- add basic implementation of a caption field to the embed card
This commit is contained in:
Kevin Ansfield 2018-02-20 15:53:58 +00:00
parent 5fa1b28a53
commit 37f393ca27
2 changed files with 26 additions and 6 deletions

View file

@ -23,13 +23,21 @@ export default Component.extend({
actions: { actions: {
updateHtml(html) { updateHtml(html) {
this._updatePayloadAttr('html', html);
},
updateCaption(caption) {
this._updatePayloadAttr('caption', caption);
}
},
_updatePayloadAttr(attr, value) {
let payload = this.get('payload'); let payload = this.get('payload');
let save = this.get('saveCard'); let save = this.get('saveCard');
set(payload, 'html', html); set(payload, attr, value);
// update the mobiledoc and stay in edit mode // update the mobiledoc and stay in edit mode
save(payload, false); save(payload, false);
} }
}
}); });

View file

@ -11,8 +11,20 @@
autofocus=true autofocus=true
update=(action "updateHtml") update=(action "updateHtml")
}} }}
<input
value={{payload.caption}}
type="text"
class="miw-100 tc bn form-text"
oninput={{action "updateCaption" value="target.value"}}
placeholder="Type caption for embed (optional)">
{{else}} {{else}}
{{{payload.html}}} {{{payload.html}}}
{{#if payload.caption}}
<p class={{kg-style "figcaption"}}>{{{payload.caption}}}</p>
{{/if}}
<div class="koenig-card-click-overlay"></div> <div class="koenig-card-click-overlay"></div>
{{/if}} {{/if}}
{{/koenig-card}} {{/koenig-card}}