draftjs-to-html icon indicating copy to clipboard operation
draftjs-to-html copied to clipboard

Inline style does not get included in HTML

Open henryson opened this issue 6 years ago • 5 comments

I use draftjs-color-picker version 1.0.2 and draftToHtml version 0.8.3 and this is my code:

const contentRaw = convertToRaw(this.state.editorState.getCurrentContent())
const contentHtml = draftToHtml(contentRaw)

contentRaw:

{
blocks: Array(1)
0: data: {}
depth: 0
entityRanges: []
inlineStyleRanges: Array(1)
0: {offset: 4, length: 4, style: "CUSTOM_COLOR_rgba(74, 144, 226, 1)"}
length: 1
__proto__: Array(0)
key: "2h4he"
text: "One blue color"
...

contentHtml: <p>One blue color</p>

When I look at demo of https://jpuri.github.io/react-draft-wysiwyg/#/demo I can see that the same code produces styled HTML.

Why does it not work for me?

henryson avatar Mar 29 '18 09:03 henryson

I found out the reason myself. The draftjs-color-picker has a different format of color inline style prefix, I assumed the editor used this plugin. I later noticed that it was not part of the DraftJS Plugins.

henryson avatar Mar 29 '18 12:03 henryson

Are you able to come up with a solution with this?

JMA12 avatar Jun 21 '19 02:06 JMA12

I don't remember other than that I confused it for a draftjs plugin. But we moved from draftjs to other editor.

Cheers, Josef

On Fri, Jun 21, 2019 at 4:58 AM +0200, "JMA12" [email protected] wrote:

Are you able to come up with a solution with this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

henryson avatar Jun 21 '19 06:06 henryson

Aww, I see.

Btw thanks, cheers

JMA12 avatar Jun 21 '19 06:06 JMA12

Well,, I have a similar problem and first demo here in this link also has this issue? I wonder if this is a limitation of the editor itself? In that case it's a major issue https://jpuri.github.io/react-draft-wysiwyg/#/demo

SujithChowdari avatar Feb 04 '21 02:02 SujithChowdari