How to implement html editor in product description


#1

hi , everyone
i want to implement html editor in description of product description in reaction. like the one in this forum’s new topic description. any suggestions and ideas.


#2

actually I am implementing trumbowyg html-editor in reaction. but when i edit description its not adding in description field and in schema


#3

:roll_eyes: anyone, still has no idea


#4

Hi,
we don’t support HTML in product descriptions deliberately. This would impose security related issues that would need to be addressed carefully. For more details, please have a look into our FAQ’s, section “How to add HTML/markup to the product descriptions”: https://docs.reactioncommerce.com/reaction-docs/master/developer-faq#how-do-i-add-htmlmarkup-to-my-product-descriptions


#5

But what if what I want just return line. Do some simple format for description. Or add a link into it.

update1:

I understand why you did that. But I really need some level customization for description. Or the presentation of the page is too simple. And we have relative strict access control over shop manager. So that I think it would be ok.

Just in case someone else feel interested. @amalan
Solution 1: https://stackoverflow.com/questions/19266197/reactjs-convert-to-html/27938353#27938353
Solution 2: https://github.com/utatti/react-render-html
imports/plugins/included/product-detail-simple/client/components/productField.js L140 ~

   if (this.props.element) {
      return React.createElement(this.props.element, {
        className: classNames,
        itemProp: this.props.itemProp,
        // children: renderHTML(`<div>${this.value ? this.value : ""}</div>`) Soloution 2
        dangerouslySetInnerHTML: {__html: this.value}
      });
    }

    return (
      <div className={classNames}>
        {/*{renderHTML(`<div>${this.value ? this.value : ""}</div>`)}*/} Solution 2
        <span dangerouslySetInnerHTML={{__html: this.value}} />
      </div>
    );

S


#6

Thanks all for the response
I have figured out the solution, I just used trubowyg package to solve the problem working fine