Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19091

When using the Mentions macro, new instances of CKEditor can fail to load after page initialization

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    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.

      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#L229

      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 :

      Attachments

        Activity

          People

            mleduc Manuel Leduc
            caubin Clément Aubin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: