Mention Plugin - Error thrown when displaying mentions in readOnly Editor
See original GitHub issueMentions 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 "}]}
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Cannot edit in read-only editor VS Code - Stack Overflow
Go to File > Preference > Settings then; type: run code and scroll down until you see code-runner: Run in terminal, There will...
Read more >Error codes - CKEditor 5 Documentation
Technically speaking, this error occurs because after adding a plugin to an existing editor build the dependencies of this plugin are being duplicated....
Read more >Unity 2019.2.2f1 - Gradle Build Failed.
Gradle fails to build and throws the following error: CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2020.1.
Read more >Troubleshoot plug-ins - Power Apps - Microsoft Learn
This error simply means that the worker process running your plug-in code crashed. The reason it crashed may be your plug-in, but it...
Read more >The option setting 'android.enableR8=false' is deprecated.
After that build has started throwing following error. ... I have tried many solutions mentioned on different forums, changed Gradle version ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is the workaround that solved this issue for me:
Hope this helps with finding more permanent solution for this bug.
This got already fixed in the latest version of the mentions plugin. It not accepts immutable data structures as well as plain JS objects: https://github.com/draft-js-plugins/draft-js-plugins/pull/326