🐛 Fixed links in signup terms (#19235)
fixes https://github.com/TryGhost/Product/issues/4222 fixes PROD-197 - links in signup terms were not opening properly, as we open Portal within an iframe - the previous fix in place did not work anymore, as the HTML structure of the signup terms has changed
This commit is contained in:
parent
7ce5abb155
commit
fd1a08641e
@ -6,6 +6,7 @@ import CloseButton from '../common/CloseButton';
|
||||
import InputForm from '../common/InputForm';
|
||||
import {getCurrencySymbol, getProductFromId, hasMultipleProductsFeature, isSameCurrency, formatNumber, hasMultipleNewsletters} from '../../utils/helpers';
|
||||
import {ValidateInputForm} from '../../utils/form';
|
||||
import {interceptAnchorClicks} from '../../utils/links';
|
||||
import NewsletterSelectionPage from './NewsletterSelectionPage';
|
||||
|
||||
export const OfferPageStyles = () => {
|
||||
@ -252,13 +253,6 @@ export default class OfferPage extends React.Component {
|
||||
|
||||
const className = `gh-portal-signup-terms ${errorClassName}`;
|
||||
|
||||
const interceptAnchorClicks = (e) => {
|
||||
if (e.target.tagName === 'A') {
|
||||
e.preventDefault();
|
||||
window.open(e.target.href, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={className} onClick={interceptAnchorClicks}>
|
||||
{signupTerms}
|
||||
|
@ -9,6 +9,7 @@ import InputForm from '../common/InputForm';
|
||||
import {ValidateInputForm} from '../../utils/form';
|
||||
import {getSiteProducts, getSitePrices, hasOnlyFreePlan, isInviteOnlySite, freeHasBenefitsOrDescription, hasOnlyFreeProduct, getFreeProductBenefits, getFreeTierDescription, hasMultipleNewsletters, hasFreeTrialTier, isSignupAllowed} from '../../utils/helpers';
|
||||
import {ReactComponent as InvitationIcon} from '../../images/icons/invitation.svg';
|
||||
import {interceptAnchorClicks} from '../../utils/links';
|
||||
|
||||
export const SignupPageStyles = `
|
||||
.gh-portal-back-sitetitle {
|
||||
@ -530,13 +531,6 @@ class SignupPage extends React.Component {
|
||||
|
||||
const className = `gh-portal-signup-terms ${errorClassName}`;
|
||||
|
||||
const interceptAnchorClicks = (e) => {
|
||||
if (e.target.tagName === 'A') {
|
||||
e.preventDefault();
|
||||
window.open(e.target.href, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={className} onClick={interceptAnchorClicks}>
|
||||
{signupTerms}
|
||||
|
10
apps/portal/src/utils/links.js
Normal file
10
apps/portal/src/utils/links.js
Normal file
@ -0,0 +1,10 @@
|
||||
export const interceptAnchorClicks = (e) => {
|
||||
if (e.currentTarget.contains(e.target)) {
|
||||
const anchor = e.target.closest('a');
|
||||
|
||||
if (anchor) {
|
||||
e.preventDefault();
|
||||
window.open(anchor.href, '_blank');
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user