Skip to content

Commit

Permalink
UIU-3267 correctly import from dompurify
Browse files Browse the repository at this point in the history
Import from `dompurify` as shown in example code; `sanitize` was never
deliberatly provided as a named export. Not sure how this ever worked.

Refs UIU-3267
  • Loading branch information
zburke committed Nov 13, 2024
1 parent ff9ca05 commit 2eaf308
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [11.1.0] In progress

* Correctly import from `dompurify`. Refs UIU-3267.


## [11.0.1](https://github.com/folio-org/ui-users/tree/v11.0.1) (2024-11-08)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.0...v11.0.1)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@
},
"dependencies": {
"compressorjs": "^1.2.1",
"dompurify": "^3.1.7",
"dompurify": "^3.2.0",
"final-form-set-field-data": "^1.0.2",
"get-orientation": "^1.1.2",
"hashcode": "^1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import Barcode from 'react-barcode';
import PropTypes from 'prop-types';
import HtmlToReact, { Parser } from 'html-to-react';
import { sanitize } from 'dompurify';
import DOMPurify from 'dompurify';

const processNodeDefinitions = new HtmlToReact.ProcessNodeDefinitions(React);
const rules = [
Expand All @@ -20,7 +20,7 @@ const rules = [
const parser = new Parser();

const PrintTemplate = ({ dataSource, templateFn }) => {
const componentStr = sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] });
const componentStr = DOMPurify.sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] });
const Component = parser.parseWithInstructions(componentStr, () => true, rules) || null;

return Component;
Expand Down

0 comments on commit 2eaf308

Please sign in to comment.