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/bugfix/target blank links crash opera #432

Merged
merged 23 commits into from Jul 30, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cb812e1
Modify the way links are implemented in the Help view so that they wo…
wlycdgr Jul 23, 2019
6284827
Factor generic handler for clicks on fixed destination links out to m…
wlycdgr Jul 23, 2019
2473de4
Simplify Help view to render using a function component
wlycdgr Jul 23, 2019
af1b63b
Revise doc comment for Help component. Convert Subscribe view to Oper…
wlycdgr Jul 24, 2019
5323638
Merge branch 'develop' into GH-1767/bugfix/target-blank-links-crash-O…
wlycdgr Jul 25, 2019
82f96ae
Factor out fixed destination panel to tab link to building block func…
wlycdgr Jul 25, 2019
add416d
Convert links in Help to use PanelToTabLink
wlycdgr Jul 25, 2019
75b52e1
Modify the legal consent checkbox label implementation in the create …
wlycdgr Jul 25, 2019
d438756
Add doc comment and explanatory note to CreateAccount#_renderLegalCon…
wlycdgr Jul 25, 2019
c7405d6
Add a period to the end of the legal consent checkbox label.
wlycdgr Jul 25, 2019
ca50b61
Merge branch 'develop' into GH-1767/bugfix/target-blank-links-crash-O…
wlycdgr Jul 25, 2019
93457f3
GH-1767: operra target blank crash fix.
jsignanini Jul 26, 2019
ae703ef
Merge in José's I18nWithLink shared component as a better solution fo…
wlycdgr Jul 29, 2019
6b1061d
Reuse openFixedDestinationLinkInNewTab in the new I18nWithLink compon…
wlycdgr Jul 29, 2019
f6225b8
Add doc header to I18nWithLink
wlycdgr Jul 29, 2019
ccddcc5
Add documentation to PanelToTabLink and I18nWithLink
wlycdgr Jul 29, 2019
79b0224
update doc haeder
christophertino Jul 29, 2019
b156d23
Merge branch 'develop' into GH-1767/bugfix/target-blank-links-crash-O…
jsignanini Jul 29, 2019
97fd48c
Refactor PanelToTabLink to work with arbitrary child elements. Rename…
wlycdgr Jul 29, 2019
6a4d033
Merge branch 'GH-1767/bugfix/target-blank-links-crash-Opera' of githu…
wlycdgr Jul 29, 2019
f81341c
Merge branch 'develop' into GH-1767/bugfix/target-blank-links-crash-O…
wlycdgr Jul 30, 2019
a30d3df
Fix Opera link bug in StatsView
wlycdgr Jul 30, 2019
a5acac5
Specify default for optional cssClasses prop to I18nWithLink
wlycdgr Jul 30, 2019
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.