Skip to content

Commit

Permalink
fix(elements-dev-portal): link hover text (stoplightio#2275)
Browse files Browse the repository at this point in the history
* fix(elements-dev-portal): link hover text

* chore: circle ci

* v1.9.4
  • Loading branch information
kaylachun authored Nov 3, 2022
1 parent c5b5fbb commit 943de40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/elements-dev-portal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stoplight/elements-dev-portal",
"version": "1.9.3",
"version": "1.9.4",
"description": "UI components for composing beautiful developer documentation.",
"keywords": [],
"sideEffects": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export const NodeContent = ({
const NodeLinkContext = React.createContext<[Node, CustomLinkComponent] | undefined>(undefined);

const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
const LinkComponent: CustomComponentMapping['a'] = ({ children, href }) => {
const LinkComponent: CustomComponentMapping['a'] = ({ children, href, title }) => {
const ctx = React.useContext(NodeLinkContext);

if (href && externalRegex.test(href)) {
// Open external URL in a new tab
return (
<a href={href} target="_blank" rel="noreferrer">
<a href={href} target="_blank" rel="noreferrer" title={title ? title : undefined}>
{children}
</a>
);
Expand Down

0 comments on commit 943de40

Please sign in to comment.