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
35 changes: 16 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-text-to-react",
"version": "0.0.5",
"version": "0.1.0",
"description": "A safe way to display HTML as React components without the risk of cross-site-scripting",
"main": "dist/HtmlTextToReact.js",
"types": "dist/HtmlTextToReact.d.ts",
Expand All @@ -21,24 +21,21 @@
"author": "Code42",
"license": "MIT",
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0 || ^16.0.0-0"
"react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@types/chai": "^4.1.1",
"@types/enzyme": "^3.1.6",
"@types/enzyme-adapter-react-16": "^1.0.1",
"@types/mocha": "^2.2.46",
"@types/react": "^16.0.34",
"chai": "^4.1.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"jsdom": "^11.5.1",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/react": "^18.0.15",
"chai": "^4.3.6",
"enzyme": "^3.11.0",
"@zarconontol/enzyme-adapter-react-18": "^0.7.3",
"jsdom": "^20.0.0",
"jsdom-global": "^3.0.2",
"mocha": "^4.1.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"ts-node": "^4.1.0",
"typescript": "^2.6.2"
},
"dependencies": {}
}
"mocha": "^10.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-node": "^10.8.2",
"typescript": "^4.7.4"
}
}
4 changes: 2 additions & 2 deletions src/HtmlTextToReact.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

type WHITELISTED_HTML_TAGS = keyof ElementTagNameMap;
type WHITELISTED_HTML_ATTRIBUTES = keyof React.AllHTMLAttributes < any > | string;
type WHITELISTED_HTML_TAGS = keyof (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>);
type WHITELISTED_HTML_ATTRIBUTES = keyof React.AllHTMLAttributes<any> | string;

// Node object isn't available when testing, so hardcode Node.ELEMENT_NODE as 1
const ELEMENT_NODE_TYPE = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/test/HtmlTextToReact-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createElementsFromText } from '../HtmlTextToReact';

// setup enzyme
import { configure } from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';
import * as Adapter from '@zarconontol/enzyme-adapter-react-18';
configure({ adapter: new Adapter() });

describe('createElementsFromText', () => {
Expand Down