Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/html-element-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We fixed a warning related to non-unique "key" props that appeared in certain scenarios.

## [1.2.2] - 2025-03-14

### Security
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/html-element-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@mendix/widget-plugin-component-kit": "workspace:*",
"dompurify": "^3.2.6"
"dompurify": "^3.3.0"
},
"devDependencies": {
"@mendix/automation-utils": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, JSX, ReactElement } from "react";
import { Fragment, JSX, ReactElement, useId } from "react";

import { HTMLElementContainerProps } from "../typings/HTMLElementProps";
import {
Expand All @@ -16,15 +16,17 @@ export function HTMLElement(props: HTMLElementContainerProps): ReactElement | nu
const tag = prepareTag(props.tagName, props.tagNameCustom);
const items = props.tagUseRepeat ? props.tagContentRepeatDataSource?.items : [undefined];

const id = useId();

if (!items?.length) {
return null;
}

return (
<Fragment>
{items.map(item => (
{items.map((item, index) => (
<HTMLTag
key={item?.id}
key={`${id}_${item?.id || index}`}
tagName={tag as keyof JSX.IntrinsicElements}
attributes={{
...prepareAttributes(createAttributeResolver(item), props.attributes, props.class, props.style),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("HTMLTag", () => {
});

it("with innerHTML apply html sanitizing", () => {
const checkSapshot = (html: string): void => {
const checkSnapshot = (html: string): void => {
expect(
render(
<HTMLTag
Expand All @@ -53,10 +53,10 @@ describe("HTMLTag", () => {
).toMatchSnapshot();
};

checkSapshot("<p>Lorem ipsum <script>alert(1)</script></p>");
checkSapshot("<img src=x onerror=alert(1)>");
checkSapshot(`<b onmouseover=alert(‘XSS testing!‘)>ok</b>`);
checkSapshot("<a>123</a><option><style><img src=x onerror=alert(1)></style>");
checkSnapshot("<p>Lorem ipsum <script>alert(1)</script></p>");
checkSnapshot("<img src=x onerror=alert(1)>");
checkSnapshot(`<b onmouseover=alert(‘XSS testing!‘)>ok</b>`);
checkSnapshot("<a>123</a><option><style><img src=x onerror=alert(1)></style>");
});

it("fires events", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/rich-text-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@uiw/codemirror-theme-github": "^4.23.13",
"@uiw/react-codemirror": "^4.23.13",
"classnames": "^2.5.1",
"dompurify": "^3.2.6",
"dompurify": "^3.3.0",
"js-beautify": "^1.15.4",
"katex": "^0.16.22",
"linkifyjs": "^4.3.2",
Expand Down
20 changes: 4 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading