Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1767: Opera target blank crash fix #429

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

GH-1767: operra target blank crash fix.

  • Loading branch information
jsignanini committed Jul 26, 2019
commit 93457f37391d54739e691fcd265c6c70bc6b944a
@@ -15,7 +15,9 @@ import React from 'react';
import { Link } from 'react-router-dom';
import ClassNames from 'classnames';
import RSVP from 'rsvp';

import { validateEmail, validateConfirmEmail, validatePassword } from '../utils/utils';
import I18nWithLink from '../../shared-components/I18nWithLink';

/**
* @class Implement Create Account view which opens
@@ -215,7 +217,9 @@ class CreateAccount extends React.Component {
<div id="create-account-legal-consent-checkbox" className={(legalConsentNotCheckedError ? 'checkbox-error' : '')}>
<input id="legalConsentChecked" name="legalConsentChecked" type="checkbox" checked={legalConsentChecked} onChange={this.handleCheckboxChange} />
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
<label htmlFor="legalConsentChecked" dangerouslySetInnerHTML={{ __html: t('create_account_form_legal_consent_checkbox_label') }} />
<label htmlFor="legalConsentChecked">
<I18nWithLink value="create_account_form_legal_consent_checkbox_label" />
</label>
</div>
</div>
</div>
@@ -0,0 +1,42 @@
import React, { Component, createRef } from 'react';
import PropTypes from 'prop-types';

import { sendMessage } from '../../panel/utils/msg';

class I18nWithLink extends Component {
constructor(props) {
super(props);
this.containerRef = createRef();
}

componentDidMount() {
const { current: { children } } = this.containerRef;
for (let i = 0; i < children.length; i++) {
const ele = children[i];
if (ele.nodeName.toLowerCase() !== 'a') {
return;
}
ele.onclick = (e) => {
e.preventDefault();
const { href } = e.target;
sendMessage('openNewTab', {
url: href,
become_active: true,
});
};
}
}

render() {
const { value } = this.props;
return (
<span ref={this.containerRef} dangerouslySetInnerHTML={{ __html: t(value) }} />
);
}
}

export default I18nWithLink;

I18nWithLink.propTypes = {
value: PropTypes.string.isRequired,
};
@@ -0,0 +1,16 @@
/**
* Point of entry index.js file for I18nWithLink
*
* Ghostery Browser Extension
* https://www.ghostery.com/
*
* Copyright 2019 Ghostery, Inc. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import I18nWithLink from './I18nWithLink';

export default I18nWithLink;
ProTip! Use n and p to navigate between commits in a pull request.