We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"entityMap":{"0":{"type":"IMAGE","mutability":"MUTABLE","data":{"src":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRWO_UAe27eAhTik2ggPbzKGQfuXD1oVosA_Q&usqp=CAU","height":"auto","width":"auto","alignment":"right"}}}
The text was updated successfully, but these errors were encountered:
did you solved this problem?
Sorry, something went wrong.
Here is my state.
{ "blocks": [ { "key": "c407s", "text": " ", "type": "atomic", "depth": 0, "inlineStyleRanges": [], "entityRanges": [{ "offset": 0, "length": 1, "key": 0 }], "data": {} } ], "entityMap": { "0": { "type": "IMAGE", "mutability": "IMMUTABLE", "data": { "url": "https://shanghai.aliyuncs.com/images/41600b6b-37be-4229-8adb-da4bfa4c6b7e.jpg", "name": "1668482961564_5", "type": "IMAGE", "meta": { "id": "images/41600b6b-37be-4229-8adb-da4bfa4c6b7e.jpg", "title": "c96fd0302923c17f7dcf2b8f859fdc50.jpg", "alt": "c96fd0302923c17f7dcf2b8f859fdc50.jpg", "loop": false, "autoPlay": false, "controls": false, "poster": "" } } } } }
It works after I add a atomicHandler like this:
const atomicHandler = (item: any, entityMap: any): any => { for (let entityItem of item.entityRanges) { if (entityMap.hasOwnProperty(entityItem.key)) { const entity = entityMap[entityItem.key]; console.log(entity); if (entity.type === 'IMAGE') { return ( <Image source={{uri: entity.data.url}} width={100} /> ); } } } return null; };
getRNDraftJSBlocks({ contentState: state, atomicHandler, }),
No branches or pull requests
"entityMap":{"0":{"type":"IMAGE","mutability":"MUTABLE","data":{"src":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRWO_UAe27eAhTik2ggPbzKGQfuXD1oVosA_Q&usqp=CAU","height":"auto","width":"auto","alignment":"right"}}}
The text was updated successfully, but these errors were encountered: