Browse Source

docs: Link support open in new tab or window (#43398)

* docs: Link support open in new tab or window

* docs: apply more Linki

* Revert "docs: apply more Linki"

This reverts commit e19ddd7479.
pull/43403/head
MadCcc 1 year ago
committed by GitHub
parent
commit
78923c541a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .dumi/theme/builtins/ComponentTokenTable/index.tsx
  2. 11
      .dumi/theme/common/Link.tsx

12
.dumi/theme/builtins/ComponentTokenTable/index.tsx

@ -150,11 +150,13 @@ const ComponentTokenTable: React.FC<ComponentTokenTableProps> = ({ component })
return (
<>
<SubTokenTable
title={locale.componentToken}
tokens={tokenMeta.components[component].map((item) => item.token)}
component={component}
/>
{tokenMeta.components[component] && (
<SubTokenTable
title={locale.componentToken}
tokens={tokenMeta.components[component].map((item) => item.token)}
component={component}
/>
)}
<SubTokenTable title={locale.globalToken} tokens={mergedGlobalTokens} />
</>
);

11
.dumi/theme/common/Link.tsx

@ -14,10 +14,13 @@ const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
if (!to.startsWith('http')) {
e.preventDefault();
startTransition(() => {
navigate(to);
});
// Should support open in new tab
if (!e.metaKey && !e.ctrlKey && !e.shiftKey) {
e.preventDefault();
startTransition(() => {
navigate(to);
});
}
}
};

Loading…
Cancel
Save