Browse Source

fix: remove `noreferrer` on internal links (#9452)

* fix: remove `noreferrer` on internal links

* fix snaps

* fix lint
pull/9446/merge
David Luzar 8 months ago committed by GitHub
parent
commit
4a60fe3d22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      .eslintrc.json
  2. 2
      excalidraw-app/components/AI.tsx
  3. 2
      excalidraw-app/components/EncryptedIcon.tsx
  4. 2
      excalidraw-app/components/ExcalidrawPlusAppLink.tsx
  5. 2
      excalidraw-app/tests/__snapshots__/MobileMenu.test.tsx.snap
  6. 4
      packages/excalidraw/components/HelpDialog.tsx
  7. 2
      packages/excalidraw/components/PublishLibrary.tsx
  8. 5
      packages/excalidraw/components/dropdownMenu/DropdownMenuItemLink.tsx
  9. 2
      packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx
  10. 8
      packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap

6
.eslintrc.json

@ -32,6 +32,12 @@ @@ -32,6 +32,12 @@
"name": "jotai",
"message": "Do not import from \"jotai\" directly. Use our app-specific modules (\"editor-jotai\" or \"app-jotai\")."
}
],
"react/jsx-no-target-blank": [
"error",
{
"allowReferrer": true
}
]
}
}

2
excalidraw-app/components/AI.tsx

@ -73,7 +73,7 @@ export const AIComponents = ({ @@ -73,7 +73,7 @@ export const AIComponents = ({
</br>
<div>You can also try <a href="${
import.meta.env.VITE_APP_PLUS_LP
}/plus?utm_source=excalidraw&utm_medium=app&utm_content=d2c" target="_blank" rel="noreferrer noopener">Excalidraw+</a> to get more requests.</div>
}/plus?utm_source=excalidraw&utm_medium=app&utm_content=d2c" target="_blank" rel="noopener">Excalidraw+</a> to get more requests.</div>
</div>
</body>
</html>`,

2
excalidraw-app/components/EncryptedIcon.tsx

@ -10,7 +10,7 @@ export const EncryptedIcon = () => { @@ -10,7 +10,7 @@ export const EncryptedIcon = () => {
className="encrypted-icon tooltip"
href="https://plus.excalidraw.com/blog/end-to-end-encryption"
target="_blank"
rel="noopener noreferrer"
rel="noopener"
aria-label={t("encrypted.link")}
>
<Tooltip label={t("encrypted.tooltip")} long={true}>

2
excalidraw-app/components/ExcalidrawPlusAppLink.tsx

@ -10,7 +10,7 @@ export const ExcalidrawPlusAppLink = () => { @@ -10,7 +10,7 @@ export const ExcalidrawPlusAppLink = () => {
import.meta.env.VITE_APP_PLUS_APP
}?utm_source=excalidraw&utm_medium=app&utm_content=signedInUserRedirectButton#excalidraw-redirect`}
target="_blank"
rel="noreferrer"
rel="noopener"
className="plus-button"
>
Go to Excalidraw+

2
excalidraw-app/tests/__snapshots__/MobileMenu.test.tsx.snap

@ -198,7 +198,7 @@ exports[`Test MobileMenu > should initialize with welcome screen and hide once u @@ -198,7 +198,7 @@ exports[`Test MobileMenu > should initialize with welcome screen and hide once u
<a
class="welcome-screen-menu-item "
href="undefined/plus?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenGuest"
rel="noreferrer"
rel="noopener"
target="_blank"
>
<div

4
packages/excalidraw/components/HelpDialog.tsx

@ -21,7 +21,7 @@ const Header = () => ( @@ -21,7 +21,7 @@ const Header = () => (
className="HelpDialog__btn"
href="https://docs.excalidraw.com"
target="_blank"
rel="noopener noreferrer"
rel="noopener"
>
<div className="HelpDialog__link-icon">{ExternalLinkIcon}</div>
{t("helpDialog.documentation")}
@ -30,7 +30,7 @@ const Header = () => ( @@ -30,7 +30,7 @@ const Header = () => (
className="HelpDialog__btn"
href="https://plus.excalidraw.com/blog"
target="_blank"
rel="noopener noreferrer"
rel="noopener"
>
<div className="HelpDialog__link-icon">{ExternalLinkIcon}</div>
{t("helpDialog.blog")}

2
packages/excalidraw/components/PublishLibrary.tsx

@ -389,7 +389,7 @@ const PublishLibrary = ({ @@ -389,7 +389,7 @@ const PublishLibrary = ({
<a
href="https://libraries.excalidraw.com"
target="_blank"
rel="noopener noreferrer"
rel="noopener"
>
{el}
</a>

5
packages/excalidraw/components/dropdownMenu/DropdownMenuItemLink.tsx

@ -16,7 +16,7 @@ const DropdownMenuItemLink = ({ @@ -16,7 +16,7 @@ const DropdownMenuItemLink = ({
onSelect,
className = "",
selected,
rel = "noreferrer",
rel = "noopener",
...rest
}: {
href: string;
@ -31,11 +31,12 @@ const DropdownMenuItemLink = ({ @@ -31,11 +31,12 @@ const DropdownMenuItemLink = ({
const handleClick = useHandleDropdownMenuItemClick(rest.onClick, onSelect);
return (
// eslint-disable-next-line react/jsx-no-target-blank
<a
{...rest}
href={href}
target="_blank"
rel="noreferrer"
rel={rel || "noopener"}
className={getDropdownMenuItemClassName(className, selected)}
title={rest.title ?? rest["aria-label"]}
onClick={handleClick}

2
packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx

@ -78,7 +78,7 @@ const WelcomeScreenMenuItemLink = ({ @@ -78,7 +78,7 @@ const WelcomeScreenMenuItemLink = ({
className={`welcome-screen-menu-item ${className}`}
href={href}
target="_blank"
rel="noreferrer"
rel="noopener"
>
<WelcomeScreenMenuItemContent icon={icon} shortcut={shortcut}>
{children}

8
packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap

@ -21,7 +21,7 @@ exports[`<Excalidraw/> > <MainMenu/> > should render main menu with host menu it @@ -21,7 +21,7 @@ exports[`<Excalidraw/> > <MainMenu/> > should render main menu with host menu it
<a
class="dropdown-menu-item dropdown-menu-item-base"
href="blog.excalidaw.com"
rel="noreferrer"
rel="noopener"
target="_blank"
>
<div
@ -392,7 +392,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende @@ -392,7 +392,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende
aria-label="GitHub"
class="dropdown-menu-item dropdown-menu-item-base"
href="https://github.com/excalidraw/excalidraw"
rel="noreferrer"
rel="noopener"
target="_blank"
title="GitHub"
>
@ -426,7 +426,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende @@ -426,7 +426,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende
aria-label="X"
class="dropdown-menu-item dropdown-menu-item-base"
href="https://x.com/excalidraw"
rel="noreferrer"
rel="noopener"
target="_blank"
title="X"
>
@ -472,7 +472,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende @@ -472,7 +472,7 @@ exports[`<Excalidraw/> > Test UIOptions prop > Test canvasActions > should rende
aria-label="Discord"
class="dropdown-menu-item dropdown-menu-item-base"
href="https://discord.gg/UexuTaE"
rel="noreferrer"
rel="noopener"
target="_blank"
title="Discord"
>

Loading…
Cancel
Save