tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MdnLink.js (918B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
      8 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
      9 const { a } = dom;
     10 
     11 loader.lazyRequireGetter(
     12  this,
     13  "openDocLink",
     14  "resource://devtools/client/shared/link.js",
     15  true
     16 );
     17 
     18 function MDNLink({ url, title }) {
     19  return a({
     20    className: "devtools-button learn-more-link",
     21    title,
     22    onClick: e => onLearnMoreClick(e, url),
     23  });
     24 }
     25 
     26 MDNLink.displayName = "MDNLink";
     27 
     28 MDNLink.propTypes = {
     29  url: PropTypes.string.isRequired,
     30 };
     31 
     32 function onLearnMoreClick(e, url) {
     33  e.stopPropagation();
     34  e.preventDefault();
     35  openDocLink(url);
     36 }
     37 
     38 module.exports = MDNLink;