Draft-js: Cursor sets incorrect for non text nodes

Created on 10 May 2017  路  2Comments  路  Source: facebook/draft-js

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)

bug

Most helpful comment

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pklavins picture pklavins  路  3Comments

B-Reif picture B-Reif  路  3Comments

ianstormtaylor picture ianstormtaylor  路  3Comments

abeq picture abeq  路  3Comments

sarawinter picture sarawinter  路  3Comments