@apify/ui-library 0.59.0 → 0.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/src/components/link.js +1 -1
- package/dist/src/components/link.js.map +1 -1
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.js +17 -14
- package/dist/src/components/to_consolidate/markdown.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/link.tsx +2 -2
- package/src/components/to_consolidate/markdown.tsx +20 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.1",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"recast": "^0.23.9",
|
|
68
68
|
"typescript": "^5.1.6"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "16fdc799cf1670638596509d7af5e0a5421a598c"
|
|
71
71
|
}
|
package/src/components/link.tsx
CHANGED
|
@@ -92,8 +92,8 @@ export const Link = forwardRef<HTMLElement, LinkProps>(({
|
|
|
92
92
|
const effectiveRel = clsx(
|
|
93
93
|
rel,
|
|
94
94
|
isExternal && 'external',
|
|
95
|
-
(isExternal || target === '_blank') && 'noopener
|
|
96
|
-
(isExternal && !isTrusted) && 'nofollow',
|
|
95
|
+
(isExternal || target === '_blank') && 'noopener',
|
|
96
|
+
(isExternal && !isTrusted) && 'nofollow noreferrer',
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
return (
|
|
@@ -417,21 +417,28 @@ const DefaultLinkRenderer = ({ node, href, ...props }: LinkRendererProps, { host
|
|
|
417
417
|
&& APIFY_HOSTNAMES.includes(urlParsed.hostname.toLowerCase())
|
|
418
418
|
&& urlParsed.protocol === 'https:'; // we want to disqualify links that have http: protocol. It's a mistake on users' side that we are penalized for.
|
|
419
419
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
// If an external non-Apify link, we want to always open it in a new tab and add rel="noopener noreferrer nofollow"
|
|
423
|
-
// (and ugc if the link comes from the user-generated content)
|
|
424
|
-
if (isApifyLink && hasDifferentHostname) {
|
|
425
|
-
linkProps = { target: '_blank', rel: 'noopener noreferrer' };
|
|
426
|
-
} else if (!hasDifferentHostname && Link) { // Same host name, use the provided link for internal navigation
|
|
420
|
+
// Same host name, use the provided link for internal navigation
|
|
421
|
+
if (!hasDifferentHostname && Link) {
|
|
427
422
|
return <Link to={urlParsed} {...props} />;
|
|
428
|
-
} else {
|
|
429
|
-
// USG - User Generated Content (new rel attribute for nofollow links)
|
|
430
|
-
// Google says:
|
|
431
|
-
// It’s valid to use nofollow with the new attributes — such as rel=”nofollow ugc”
|
|
432
|
-
// — if you wish to be backwards-compatible with services that don’t support the new attributes.
|
|
433
|
-
linkProps = { target: '_blank', rel: clsx('noopener noreferrer nofollow', isUserGeneratedContent && 'ugc') };
|
|
434
423
|
}
|
|
424
|
+
|
|
425
|
+
let linkProps = {};
|
|
426
|
+
|
|
427
|
+
// If false, we want to open the link in the same tab (linkProps won't have any props)
|
|
428
|
+
if (hasDifferentHostname) {
|
|
429
|
+
// If the link is an Apify link to the different hostname, we want to open in a new tab
|
|
430
|
+
if (isApifyLink) {
|
|
431
|
+
linkProps = { target: '_blank', rel: 'noopener' };
|
|
432
|
+
} else {
|
|
433
|
+
// If an external non-Apify link, we want to always open it in a new tab and add rel="noopener noreferrer nofollow"
|
|
434
|
+
// USG - User Generated Content (new rel attribute for nofollow links)
|
|
435
|
+
// Google says:
|
|
436
|
+
// It’s valid to use nofollow with the new attributes — such as rel=”nofollow ugc”
|
|
437
|
+
// — if you wish to be backwards-compatible with services that don’t support the new attributes.
|
|
438
|
+
linkProps = { target: '_blank', rel: clsx('noopener noreferrer', 'nofollow', isUserGeneratedContent && 'ugc') };
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
435
442
|
return <a href={href} {...props} {...linkProps} />;
|
|
436
443
|
};
|
|
437
444
|
|