Updated portal preview to use default icon

refs https://github.com/TryGhost/members.js/issues/77

- By default, if there is no icon button selected, we fallback to show the first icon in list as selected in both preview and portal
This commit is contained in:
Rish 2020-08-06 16:21:27 +05:30
parent edad489d56
commit aa6e138e5c
1 changed files with 3 additions and 0 deletions

View File

@ -136,6 +136,9 @@ export default ModalComponent.extend({
this.iconExtensions = ICON_EXTENSIONS;
const portalButtonIcon = this.settings.get('portalButtonIcon') || '';
const defaultIconKeys = this.defaultButtonIcons.map(buttonIcon => buttonIcon.value);
if (!portalButtonIcon) {
this.set('buttonIcon', defaultIconKeys[0]);
}
if (portalButtonIcon && !defaultIconKeys.includes(portalButtonIcon)) {
this.set('customIcon', this.settings.get('portalButtonIcon'));
}