jpuri / jpuri/html-to-draftjs

htmlToDraft adds extra space to text node

Open
#104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
163
Forks
104
PR merge metrics
No merged PRs in 30d

Description

console.log(html);
const contentBlock = htmlToDraft(html);
contentBlock.contentBlocks.forEach(i => console.log(i.toJS()));

first console.log prints this

<ul> 
 <li>sdf</li> 
</ul>

console.log for contentBlock prints this

characterList: (4) [{…}, {…}, {…}, {…}]
data: {}
depth: 0
key: "8fh3d"
text: "sdf "
type: "unordered-list-item"

as you see it adds extra space to text inside <li>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the htmlToDraft entry point and reproduce the issue with the HTML shown in the report, comparing the source output with the generated content block. Done means text inside the list item is preserved without the trailing extra space.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.