Ghost/ghost/admin/lib/koenig-editor/addon/components/koenig-card-email-cta.hbs
Kevin Ansfield 84581e9109 Converted <KoenigCardEmailCta> to native class glimmer component
no issue

- switched to native class syntax
- updated to glimmer/octane syntax
- fixed infinite render issue from `<KoenigTextReplacementHtmlInput>`'s `didReceiveAttrs()` lifecycle hook
2021-07-20 18:33:39 +01:00

44 lines
1.7 KiB
Handlebars

<KoenigCard
@icon="koenig/card-indicator-email"
@class={{concat (kg-style "container-card") " kg-email-card mih10 miw-100 relative"}}
@style={{@cardStyle}}
@headerOffset={{@headerOffset}}
@toolbar={{this.toolbar}}
@payload={{@payload}}
@isSelected={{@isSelected}}
@isEditing={{@isEditing}}
@selectCard={{@selectCard}}
@deselectCard={{@deselectCard}}
@editCard={{@editCard}}
@saveCard={{@saveCard}}
@saveAsSnippet={{@saveAsSnippet}}
@onLeaveEdit={{this.leaveEditMode}}
@addParagraphAfterCard={{@addParagraphAfterCard}}
@moveCursorToPrevSection={{@moveCursorToPrevSection}}
@moveCursorToNextSection={{@moveCursorToNextSection}}
@editor={{@editor}}
as |card|
>
{{#if @isEditing}}
<KoenigTextReplacementHtmlInput
@html={{@payload.html}}
@placeholder="Email only content..."
@autofocus={{true}}
@class="miw-100 bn bg-transparent"
@onChange={{this.updateHtml}}
@onFocus={{fn (mut this.isFocused) true}}
@onBlur={{fn (mut this.isFocused) false}}
@didCreateEditor={{this.registerEditor}}
/>
<div class="kg-card-help">
<p>
<span>Only visible when delivered by email, this card will not be published on your site.</span>
<a href="https://ghost.org/help/email-newsletters/#email-cards" class="dib lh-zero v-mid kg-card-help-icon-link" target="_blank" rel="noreferer nopener">{{svg-jar "help" class="stroke-midgrey"}}</a>
</p>
</div>
{{else}}
<p>{{{this.formattedHtml}}}</p>
<div class="koenig-card-click-overlay"></div>
{{/if}}
</KoenigCard>