@tangle-network/ui 11.28.0 → 11.28.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
CHANGED
package/package.json
CHANGED
|
@@ -114,6 +114,12 @@ describe("Markdown", () => {
|
|
|
114
114
|
expect(ad.closest("a")).toHaveAttribute("target", "_blank");
|
|
115
115
|
expect(ad.closest("a")).toHaveAttribute("rel", "noopener noreferrer");
|
|
116
116
|
|
|
117
|
+
render(<Markdown>{""}</Markdown>);
|
|
118
|
+
expect(screen.getByRole("link", { name: "Open image full size" })).toHaveAttribute(
|
|
119
|
+
"href",
|
|
120
|
+
"https://example.com/decorative.png",
|
|
121
|
+
);
|
|
122
|
+
|
|
117
123
|
const badge = screen.getByRole("img", { name: "Badge" });
|
|
118
124
|
expect(badge.closest("a")).toHaveAttribute("href", "https://example.com/docs");
|
|
119
125
|
expect(badge.closest("a")?.parentElement?.closest("a")).toBeNull();
|
|
@@ -113,7 +113,14 @@ function MarkdownImage({ node: _node, src, alt, className, ...props }: Component
|
|
|
113
113
|
);
|
|
114
114
|
if (insideLink) return image;
|
|
115
115
|
return (
|
|
116
|
-
<a
|
|
116
|
+
<a
|
|
117
|
+
href={url}
|
|
118
|
+
target="_blank"
|
|
119
|
+
rel="noopener noreferrer"
|
|
120
|
+
// An image without alt text would otherwise leave the link unnamed.
|
|
121
|
+
aria-label={alt ? undefined : "Open image full size"}
|
|
122
|
+
className="inline-block max-w-full"
|
|
123
|
+
>
|
|
117
124
|
{image}
|
|
118
125
|
</a>
|
|
119
126
|
);
|