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:
parent
5fa1b28a53
commit
37f393ca27
2 changed files with 26 additions and 6 deletions
|
@ -23,13 +23,21 @@ export default Component.extend({
|
|||
|
||||
actions: {
|
||||
updateHtml(html) {
|
||||
this._updatePayloadAttr('html', html);
|
||||
},
|
||||
|
||||
updateCaption(caption) {
|
||||
this._updatePayloadAttr('caption', caption);
|
||||
}
|
||||
},
|
||||
|
||||
_updatePayloadAttr(attr, value) {
|
||||
let payload = this.get('payload');
|
||||
let save = this.get('saveCard');
|
||||
|
||||
set(payload, 'html', html);
|
||||
set(payload, attr, value);
|
||||
|
||||
// update the mobiledoc and stay in edit mode
|
||||
save(payload, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,8 +11,20 @@
|
|||
autofocus=true
|
||||
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}}
|
||||
{{{payload.html}}}
|
||||
|
||||
{{#if payload.caption}}
|
||||
<p class={{kg-style "figcaption"}}>{{{payload.caption}}}</p>
|
||||
{{/if}}
|
||||
|
||||
<div class="koenig-card-click-overlay"></div>
|
||||
{{/if}}
|
||||
{{/koenig-card}}
|
||||
|
|
Loading…
Add table
Reference in a new issue