2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

🐛 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:
Sag 2023-12-05 10:47:27 -03:00 committed by GitHub
parent 7ce5abb155
commit fd1a08641e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 14 deletions

View file

@ -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}

View file

@ -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}

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