-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Mentions are correctly inserted in the Editor in editing mode but do not work in readOnly mode.
The thrown error: Unhandled promise rejection TypeError: mention.has is not a function(…)
Details of the error
The error comes from this code if (mention.has('link'))
As Entity.get(entityKey)
returns an object, the code tries to use .has() on an Object so it throws an exception.
Scenario to reproduce this error:
- In edit mode : add some mentions
- Save your rawContent somewhere like in a database so you can reuse it later (My sample below)
- Display your content in an readOnly Editor
If you want to test it quickly, here is my rawContent:
{"entityMap": {"0": {"type": "mention", "mutability": "IMMUTABLE", "data": {"mention": {"link": "/user/17", "name": "Maxime Rota", "avatar": "http://1A922.http.par01.cdn.softlayer.net/preprod/line_operator.jpg"}}}}, "blocks": [{"key": "en8l2", "depth": 0, "inlineStyleRanges": [], "type": "unstyled", "entityRanges": [{"key": 0, "length": 11, "offset": 0}], "text": "Maxime Rota "}]}