draftjs-to-html
draftjs-to-html copied to clipboard
Inline style does not get included in HTML
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?
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.
Are you able to come up with a solution with this?
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.
Aww, I see.
Btw thanks, cheers
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