Updated NFT card handling in the editor

refs https://github.com/TryGhost/Team/issues/1211

Using `type` rather than `card_type` since that's been replaced in the
API.

Moves the rendering of the card in the template so that we get
access to the caption editor, and selectable card (rather than the
anchor tag redirecting us to OpenSea)

Updates the `isEmpty` property to take into account NFT cards.
This commit is contained in:
Fabien O'Carroll 2021-11-16 21:33:06 +02:00
parent a87cfe0ebc
commit 6ef642a5e8
2 changed files with 8 additions and 8 deletions

View File

@ -16,13 +16,14 @@
@editor={{this.editor}}
as |card|
>
{{#if (eq this.payload.metadata.card_type "nft")}}
<KoenigCardEmbed::Nft @payload={{this.payload}} />
{{else}}
{{#if this.payload.html}}
{{#if this.payload.type}}
<div class="kg-card-hover">
<div class="koenig-embed-{{this.payload.type}} flex justify-center relative" data-kg-embed>
<iframe class="bn miw-100" scrolling="no"></iframe>
{{#if (eq this.payload.type "nft")}}
<KoenigCardEmbed::Nft @payload={{this.payload}} />
{{else}}
<iframe class="bn miw-100" scrolling="no"></iframe>
{{/if}}
<div class="koenig-card-click-overlay ba b--transparent" data-kg-overlay></div>
</div>
@ -59,5 +60,4 @@
onkeydown={{action "urlKeydown"}}>
{{/if}}
{{/if}}
{{/if}}
</KoenigCard>

View File

@ -35,7 +35,7 @@ export default Component.extend({
registerComponent() {},
isEmpty: computed('payload.html', function () {
return isBlank(this.payload.html);
return isBlank(this.payload.html) && this.payload.type !== 'nft';
}),
counts: computed('payload.{html,caption}', function () {
@ -177,7 +177,7 @@ export default Component.extend({
this.send('insertAsBookmark', response);
return;
}
if (!response.html && response.card_type !== 'nft') {
if (!response.html && response.type !== 'nft') {
throw 'No HTML returned';
}