Added an emoji toggle for the callout card

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

- Uses the KoenigSettingsPanel to display a toggle
- The Emoji is set to an empty string when disabled
- And arbitrarily set to 💡 by default when toggled back on
This commit is contained in:
Thibaut Patel 2021-11-10 15:51:11 +01:00
parent e51bcec5f1
commit 075d529e65
2 changed files with 24 additions and 0 deletions

View File

@ -33,6 +33,25 @@
@onBlur={{action (mut this.isFocused) false}}
@didCreateEditor={{action "registerEditor"}}
/>
<KoenigSettingsPanel>
<div class="kg-settings-panel-control kg-settings-panel-control-horizontal">
<div class="kg-settings-panel-control-label">Emoji</div>
<div class="kg-settings-panel-control-input">
<div class="for-switch">
<label class="switch" for="has-emoji">
<input
type="checkbox"
checked={{@payload.calloutEmoji}}
id="has-emoji"
onclick={{action "toggleEmoji"}}
data-test-has-emoji
>
<span class="input-toggle-component"></span>
</label>
</div>
</div>
</div>
</KoenigSettingsPanel>
</div>
{{else}}

View File

@ -107,6 +107,11 @@ export default class KoenigCardCalloutComponent extends Component {
run.scheduleOnce('afterRender', this, this._placeCursorAtEnd);
}
@action
toggleEmoji() {
this._updatePayloadAttr('calloutEmoji', this.args.payload.calloutEmoji ? '' : '💡');
}
_enter(modifier) {
if (this.args.isEditing && (modifier === 'meta' || (modifier === 'crtl' && Browser.isWin()))) {
this.args.editCard();