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 5cce6138e5
commit 6df368ed3b

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'));
}