When I change text to the image (or other tag) node I have problem with cursor
I do it in decorator:
return new CompositeDecorator([
{
strategy: findSpecialText,
component: imgSpan
}
]);
imgSpan:
return (
<span>
<img src="img/some.gif" width="16px" height="16px"/>
</span>
);
It works but cursor sets in random place. Sometimes after image, sometimes before text line etc.
It works correct if I use children. But I need only image instead children text. If set display:none for children cursor also sets incorrect
return (
<span>
<img src="img/some.gif" width="16px" height="16px"/>
{props.children}
</span>
);
Check it in the Chrome/FF (Ubuntu/Windows)
Thanks for reporting this and for linking to related issues! We would love to see a PR addressing this, or some work-arounds for other folks running into it. I don't think we have seen this problem in our internal uses of Draft (in 17+ apps), so I will try to look for what work-around we may have.
Most helpful comment
The same problems: https://github.com/facebook/draft-js/issues/627, https://github.com/facebook/draft-js/issues/558