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

Added support for basic HTML newsletter footer (#1765)

no-issue

This allows users to use basic HTML to customise their newsletter
footer, meaning they can use links, and bold/italic text.
This commit is contained in:
Fabien 'egg' O'Carroll 2020-11-16 10:29:32 +00:00 committed by GitHub
parent 8d8a5d8bc3
commit 96f096a839
4 changed files with 29 additions and 15 deletions

View file

@ -51,14 +51,13 @@
<div class="modal-fullsettings-section"> <div class="modal-fullsettings-section">
<GhFormGroup @classNames="vertical"> <GhFormGroup @classNames="vertical">
<h4 class="modal-fullsettings-title">Footer content</h4> <h4 class="modal-fullsettings-title">Footer content</h4>
<GhTextarea <KoenigBasicHtmlInput
@name="footer" @name="footer"
@value={{readonly this.footerContent}} @html={{this.footerContent}}
@input={{this.setFooterContent}} @class="miw-100 form-text gh-members-emailsettings-footer-input"
{{!-- The modal listens for key events to close, this stops the textarea from triggering them--}} @onChange={{this.setFooterContent}}
{{on "keydown" this.stopPropagation}} @onFocus={{this.handleInputFocus}}
{{on "keypress" this.stopPropagation}} @onBlur={{this.handleInputBlur}}
{{on "keyup" this.stopPropagation}}
/> />
<p>Extra content to show at the bottom of all emails</p> <p>Extra content to show at the bottom of all emails</p>
</GhFormGroup> </GhFormGroup>
@ -143,7 +142,7 @@
</div> </div>
<div class="gh-members-emailpreview-footer"> <div class="gh-members-emailpreview-footer">
<div class="gh-members-emailpreview-footercontent"> <div class="gh-members-emailpreview-footercontent">
{{this.footerContent}} {{{this.footerContent}}}
</div> </div>
<div class="gh-members-emailpreview-footersite"> <div class="gh-members-emailpreview-footersite">
<span>Ghost Site &copy; </span> <a href="javascript:">Unsubscribe</a> <span>Ghost Site &copy; </span> <a href="javascript:">Unsubscribe</a>

View file

@ -33,19 +33,24 @@ export default class ModalEmailDesignSettings extends ModalComponent {
this.bodyFontCategory = value; this.bodyFontCategory = value;
} }
@action
stopPropagation(event) {
event.stopPropagation();
}
@action @action
setShowBadge(event) { setShowBadge(event) {
this.showBadge = event.target.checked; this.showBadge = event.target.checked;
} }
@action @action
setFooterContent(event) { setFooterContent(value) {
this.footerContent = event.target.value; this.footerContent = value;
}
@action
handleInputFocus() {
this._removeShortcuts();
}
@action
handleInputBlur() {
this._setupShortcuts();
} }
@action @action

View file

@ -795,6 +795,12 @@ p.gh-members-import-errordetail:first-of-type {
/* Email newsletter design settings /* Email newsletter design settings
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
.gh-members-emailsettings-footer-input {
border: 1px solid var(--whitegrey);
padding: 0 6px 6px 6px;
height: 80px;
}
.gh-members-emailsettings-footer { .gh-members-emailsettings-footer {
border-top: 1px solid var(--whitegrey); border-top: 1px solid var(--whitegrey);
padding-top: 20px; padding-top: 20px;

View file

@ -176,6 +176,10 @@ export default Component.extend({
// we only care about the left mouse button // we only care about the left mouse button
if (event.which === 1) { if (event.which === 1) {
this._isMouseDown = true; this._isMouseDown = true;
// prevent mousedown on toolbar buttons losing editor focus before the following click event can trigger the buttons behaviour
if (this.element.contains(event.target)) {
event.preventDefault();
}
} }
}, },