Description
The Mentions macro will wrap an existing CKEditor method : ckeditor.replace with another method : https://github.com/xwiki/xwiki-platform/blob/ac12f8e2f29d301d4dcd677381c24b864fa1544b/xwiki-platform-core/xwiki-platform-mentions/xwiki-platform-mentions-ui/src/main/resources/XWiki/Mentions/MentionsMacro.xml#L235
However, in some cases, especially when loading a new instance of CKEditor after the page is loaded, ckeditor.replace can be called with an undefined configuration. In that case, the following line will fail, as newConf.mentions doesn't exist.
The use case for this issue is difficult to reproduce, however we found the issue as part of a project allowing to edit objects in a page using a technique similar to https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/Add%20Remove%20Objects%20Inline%20Tutorial . In that case, the addition of a first object containing a WYSIWYG editor would work well, but as soon as a second object gets added, the following stacktrace would be raised, and the CKEditor would not load properly anymore :