@bbl-digital/snorre 4.3.18 → 4.3.19

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.
@@ -7,7 +7,6 @@ exports.default = void 0;
7
7
  var _styles = require("./styles");
8
8
  var _dompurify = _interopRequireDefault(require("dompurify"));
9
9
  require("quill/dist/quill.snow.css");
10
- var _react = require("react");
11
10
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
12
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  /** @jsxImportSource @emotion/react */
@@ -25,7 +24,6 @@ const Html = ({
25
24
  whiteSpace,
26
25
  allowVideo = false
27
26
  }) => {
28
- const containerRef = (0, _react.useRef)(null);
29
27
  let _sanitizeOptions = allowVideo ? {
30
28
  ADD_TAGS: ['iframe', 'video'],
31
29
  ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling'],
@@ -36,21 +34,9 @@ const Html = ({
36
34
  let safeHtml = sanitize ? _dompurify.default.sanitize(text, _sanitizeOptions) : text;
37
35
  safeHtml = safeHtml.replace(/ /g, ' ');
38
36
  const classes = `snorre-html ${className || ''}`;
39
- (0, _react.useEffect)(() => {
40
- if (!allowVideo) return;
41
- if (containerRef.current) {
42
- console.log('containerRef.current', containerRef.current);
43
- const iframes = containerRef.current.querySelectorAll('iframe');
44
- iframes.forEach(iframe => {
45
- iframe.setAttribute('allow', 'autoplay; fullscreen; picture-in-picture');
46
- iframe.setAttribute('allowfullscreen', '');
47
- });
48
- }
49
- }, [text, allowVideo]);
50
37
  return (0, _jsxRuntime.jsx)("div", {
51
38
  className: classes,
52
39
  css: theme => [_styles.styles.default(theme), secondary && _styles.styles.secondary(theme), dark && _styles.styles.dark(theme), size && _styles.styles.size(size), _styles.styles.whiteSpace(whiteSpace ? whiteSpace : 'pre-wrap'), removeMargins && _styles.styles.removeMargins],
53
- ref: containerRef,
54
40
  dangerouslySetInnerHTML: {
55
41
  __html: externalLinks ? safeHtml.replace(/href/g, "target='_blank' href") : safeHtml
56
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Html/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,2BAA2B,CAAA;AAGlC,UAAU,MAAM;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gCAAgC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,uBAAuB;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,QAAA,MAAM,IAAI,GAAI,8HAYX,MAAM,qDA+CR,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Html/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,2BAA2B,CAAA;AAElC,UAAU,MAAM;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gCAAgC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,uBAAuB;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,QAAA,MAAM,IAAI,GAAI,8HAYX,MAAM,qDAgCR,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -7,7 +7,6 @@ exports.default = void 0;
7
7
  var _styles = require("./styles");
8
8
  var _dompurify = _interopRequireDefault(require("dompurify"));
9
9
  require("quill/dist/quill.snow.css");
10
- var _react = require("react");
11
10
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
12
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  /** @jsxImportSource @emotion/react */
@@ -25,7 +24,6 @@ const Html = ({
25
24
  whiteSpace,
26
25
  allowVideo = false
27
26
  }) => {
28
- const containerRef = (0, _react.useRef)(null);
29
27
  let _sanitizeOptions = allowVideo ? {
30
28
  ADD_TAGS: ['iframe', 'video'],
31
29
  ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling'],
@@ -36,21 +34,9 @@ const Html = ({
36
34
  let safeHtml = sanitize ? _dompurify.default.sanitize(text, _sanitizeOptions) : text;
37
35
  safeHtml = safeHtml.replace(/ /g, ' ');
38
36
  const classes = `snorre-html ${className || ''}`;
39
- (0, _react.useEffect)(() => {
40
- if (!allowVideo) return;
41
- if (containerRef.current) {
42
- console.log('containerRef.current', containerRef.current);
43
- const iframes = containerRef.current.querySelectorAll('iframe');
44
- iframes.forEach(iframe => {
45
- iframe.setAttribute('allow', 'autoplay; fullscreen; picture-in-picture');
46
- iframe.setAttribute('allowfullscreen', '');
47
- });
48
- }
49
- }, [text, allowVideo]);
50
37
  return (0, _jsxRuntime.jsx)("div", {
51
38
  className: classes,
52
39
  css: theme => [_styles.styles.default(theme), secondary && _styles.styles.secondary(theme), dark && _styles.styles.dark(theme), size && _styles.styles.size(size), _styles.styles.whiteSpace(whiteSpace ? whiteSpace : 'pre-wrap'), removeMargins && _styles.styles.removeMargins],
53
- ref: containerRef,
54
40
  dangerouslySetInnerHTML: {
55
41
  __html: externalLinks ? safeHtml.replace(/href/g, "target='_blank' href") : safeHtml
56
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.3.18",
3
+ "version": "4.3.19",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",