The convertFromHTML() method currently strips inline style attribute from HTML string.
See original GitHub issueDo you want to request a feature or report a bug? Report a bug.
What is the current behavior?
The convertFromHTML()
method strips inline style attribute from HTML strings.
When importing this HTML string (via convertFromHTML()
):
"<p>This is some <span style="color: #f0ad4e">colorful</span> text.</p>"
The line is converted to this:
"<p>This is some colorful text.</p>"
What is the expected behavior?
Keep inline style attribute when using convertFromHTML()
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Draft JS v0.8.1 running in Chrome
Issue Analytics
- State:
- Created 7 years ago
- Comments:29 (2 by maintainers)
Top Results From Across the Web
Recently Active 'draftjs' Questions - Stack Overflow
Draft.js convertFromHtml, htmlToDraft and stateFromHTML ignores style attribute. I want to initialize a Draft.js text editor with the initial state.
Read more >How can I use iText to convert HTML with images and ...
I'm using Asp.mvc 5. Just one method of the ImageProviderClass has to be changed. public virtual string GetImageRootPath() { return null; }. to...
Read more >draft-js | Yarn - Package Manager
convertFromHTML breaks after converting \n string, issue #1822 (#1823) ... into inline style to resolve insertion issues; handleDrop prop method for Editor ...
Read more >HTML.c - LYNX
$LynxId: HTML.c,v 1.192 2018/04/01 23:26:24 tom Exp ... else { /* * Just put in the ALT or pseudo-ALT string for the current...
Read more >AppleScript to create thumbnail of select… - Apple Community
You now select the files to process in the Finder, and then run the script. All comments are gone from the HTML and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This code worked for me(particularly lines 12-16) when I wanted to convert HTML as a string to draftjs data and load it in the editor’s state without stripping the HTML attributes:
https://github.com/jpuri/react-draft-wysiwyg/blob/master/stories/ConvertFromHTML/index.js
every damn thing in universe is unclear