From b24c2f160227d0225cc5c269d8d5c17c4d54741c Mon Sep 17 00:00:00 2001 From: utku-ozturk Date: Thu, 8 Aug 2024 10:59:49 +0300 Subject: [PATCH] remove passProps injected to non-jsx content --- es/components/static-pages/BasicStaticSectionBody.js | 5 +++-- src/components/static-pages/BasicStaticSectionBody.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/es/components/static-pages/BasicStaticSectionBody.js b/es/components/static-pages/BasicStaticSectionBody.js index 4b9f8ea8..01b0e6c0 100644 --- a/es/components/static-pages/BasicStaticSectionBody.js +++ b/es/components/static-pages/BasicStaticSectionBody.js @@ -4,6 +4,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; import { htmlToJSX } from './../util/object'; +import { patchedConsoleInstance as console } from './../util/patched-console'; import { compiler } from 'markdown-to-jsx'; export var BasicStaticSectionBody = /*#__PURE__*/React.memo(function (props) { var content = props.content, @@ -16,9 +17,9 @@ export var BasicStaticSectionBody = /*#__PURE__*/React.memo(function (props) { passProps = _objectWithoutProperties(props, _excluded); //In some cases, markdown to html conversion is handled by backend by assigning the content_as_html. For the rest, use markdown-to-jsx compiler. if (filetype === 'md' && typeof content === 'string' && !content_as_html) { - return /*#__PURE__*/React.createElement(element, passProps, compiler(content, markdownCompilerOptions || undefined)); + return /*#__PURE__*/React.createElement(element, null, compiler(content, markdownCompilerOptions || undefined)); } else if ((filetype === 'html' || filetype === 'rst' || filetype === 'md') && (typeof content_as_html === 'string' || typeof content === 'string')) { - return /*#__PURE__*/React.createElement(element, passProps, htmlToJSX(content_as_html || content)); + return /*#__PURE__*/React.createElement(element, null, htmlToJSX(content_as_html || content)); } else if (filetype === 'jsx' && typeof content === 'string') { return placeholderReplacementFxn(content.trim(), passProps); } else if (filetype === 'txt' && typeof content === 'string' && content.slice(0, 12) === 'placeholder:') { diff --git a/src/components/static-pages/BasicStaticSectionBody.js b/src/components/static-pages/BasicStaticSectionBody.js index 77643c54..fa7e3290 100644 --- a/src/components/static-pages/BasicStaticSectionBody.js +++ b/src/components/static-pages/BasicStaticSectionBody.js @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; import { htmlToJSX } from './../util/object'; +import { patchedConsoleInstance as console } from './../util/patched-console'; import { compiler } from 'markdown-to-jsx'; @@ -9,9 +10,9 @@ export const BasicStaticSectionBody = React.memo(function BasicStaticSectionBody const { content, content_as_html, children, filetype, element, markdownCompilerOptions, placeholderReplacementFxn, ...passProps } = props; //In some cases, markdown to html conversion is handled by backend by assigning the content_as_html. For the rest, use markdown-to-jsx compiler. if (filetype === 'md' && typeof content === 'string' && !content_as_html){ - return React.createElement(element, passProps, compiler(content, markdownCompilerOptions || undefined) ); + return React.createElement(element, null, compiler(content, markdownCompilerOptions || undefined) ); } else if ((filetype === 'html' || filetype === 'rst' || filetype === 'md') && (typeof content_as_html === 'string' || typeof content === 'string')){ - return React.createElement(element, passProps, htmlToJSX(content_as_html || content)); + return React.createElement(element, null, htmlToJSX(content_as_html || content)); } else if (filetype === 'jsx' && typeof content === 'string'){ return placeholderReplacementFxn(content.trim(), passProps); } else if (filetype === 'txt' && typeof content === 'string' && content.slice(0,12) === 'placeholder:'){