@sitecore-jss/sitecore-jss-react 22.0.0-canary.21 → 22.0.0-canary.23

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.
@@ -40,7 +40,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.LinkPropTypes = exports.Link = void 0;
41
41
  const react_1 = __importStar(require("react"));
42
42
  const prop_types_1 = __importDefault(require("prop-types"));
43
- const html_react_parser_1 = __importDefault(require("html-react-parser"));
44
43
  exports.Link = (0, react_1.forwardRef)((_a, ref) => {
45
44
  var { field, editable, showLinkTextWithChildrenPresent } = _a, otherProps = __rest(_a, ["field", "editable", "showLinkTextWithChildrenPresent"]);
46
45
  const children = otherProps.children;
@@ -59,13 +58,13 @@ exports.Link = (0, react_1.forwardRef)((_a, ref) => {
59
58
  // However, we cannot combine arbitrary unparsed HTML (innerHTML) based components with actual vDOM components (the children)
60
59
  // because the innerHTML is not parsed - it'd make a discontinuous vDOM. So, we'll go for the next best compromise of rendering the link field and children separately
61
60
  // as siblings. Should be "good enough" for most cases - and write your own helper if it isn't. Or bring xEditor out of 2006.
62
- const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper' }, otherProps), { key: 'editable' });
63
- const components = (0, html_react_parser_1.default)(markup, {
64
- htmlparser2: {
65
- lowerCaseTags: false,
66
- },
67
- });
68
- resultTags.push(react_1.default.createElement("span", Object.assign({}, htmlProps), components));
61
+ const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper', dangerouslySetInnerHTML: {
62
+ __html: markup,
63
+ } }, otherProps), { key: 'editable' });
64
+ // Exclude children, since 'dangerouslySetInnerHTML' and 'children' can't be set together
65
+ // and children will be added as a sibling
66
+ delete htmlProps.children;
67
+ resultTags.push(react_1.default.createElement("span", Object.assign({}, htmlProps)));
69
68
  // don't render normal link tag when editing, if no children exist
70
69
  // this preserves normal-ish behavior if not using a link body (no hacks required)
71
70
  if (!children) {
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React, { forwardRef } from 'react';
13
13
  import PropTypes from 'prop-types';
14
- import parse from 'html-react-parser';
15
14
  export const Link = forwardRef((_a, ref) => {
16
15
  var { field, editable, showLinkTextWithChildrenPresent } = _a, otherProps = __rest(_a, ["field", "editable", "showLinkTextWithChildrenPresent"]);
17
16
  const children = otherProps.children;
@@ -30,13 +29,13 @@ export const Link = forwardRef((_a, ref) => {
30
29
  // However, we cannot combine arbitrary unparsed HTML (innerHTML) based components with actual vDOM components (the children)
31
30
  // because the innerHTML is not parsed - it'd make a discontinuous vDOM. So, we'll go for the next best compromise of rendering the link field and children separately
32
31
  // as siblings. Should be "good enough" for most cases - and write your own helper if it isn't. Or bring xEditor out of 2006.
33
- const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper' }, otherProps), { key: 'editable' });
34
- const components = parse(markup, {
35
- htmlparser2: {
36
- lowerCaseTags: false,
37
- },
38
- });
39
- resultTags.push(React.createElement("span", Object.assign({}, htmlProps), components));
32
+ const htmlProps = Object.assign(Object.assign({ className: 'sc-link-wrapper', dangerouslySetInnerHTML: {
33
+ __html: markup,
34
+ } }, otherProps), { key: 'editable' });
35
+ // Exclude children, since 'dangerouslySetInnerHTML' and 'children' can't be set together
36
+ // and children will be added as a sibling
37
+ delete htmlProps.children;
38
+ resultTags.push(React.createElement("span", Object.assign({}, htmlProps)));
40
39
  // don't render normal link tag when editing, if no children exist
41
40
  // this preserves normal-ish behavior if not using a link body (no hacks required)
42
41
  if (!children) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-react",
3
- "version": "22.0.0-canary.21",
3
+ "version": "22.0.0-canary.23",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -62,15 +62,14 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@sitecore-feaas/clientside": "^0.1.48",
65
- "@sitecore-jss/sitecore-jss": "^22.0.0-canary.21",
65
+ "@sitecore-jss/sitecore-jss": "^22.0.0-canary.23",
66
66
  "deep-equal": "^2.1.0",
67
- "html-react-parser": "^3.0.4",
68
67
  "prop-types": "^15.8.1",
69
68
  "style-attr": "^1.3.0"
70
69
  },
71
70
  "description": "",
72
71
  "types": "types/index.d.ts",
73
- "gitHead": "df85a7964c2ad3a1a6bf27619c4686c6c1c13782",
72
+ "gitHead": "a2912e39a3d26b4e47e123a1fb9a62238edf40bf",
74
73
  "files": [
75
74
  "dist",
76
75
  "types"