sstur / draft-js-utils

DraftJS: import/export ContentState to and from HTML/Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Anchor tag inner text not rendering.

ahamed opened this issue · comments

entityStyleFn: (entity) => {
    const entityType = entity.get('type').toLowerCase();
    const data = entity.getData();
    switch(entityType){
      case 'attachment':
      return {
        element: 'a',
        attributes: { href: data.url }
      }
    }
  }
 let html = stateToHTML(contentState, options);

It returns html :
<figure><a href="...." >&nbsp;</a></figure>

How to get something like that
<figure><a href="...." >Some Text</a></figure>

Note: It returns &nbsp; as inner text. But I need Some Text as inner Text but how?

Stuck on this same issue, have you find any solution for this? @ahamed