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

Can't add a comment when BlockNote is the default WYSIWYG editor

    XMLWordPrintable

Details

    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce

      1. Set BlockNote as the default WYSIWYG editor.
      2. Open a page in view mode, open the Comments tab and type a comment.
      3. Click "Add comment".

      Expected

      The comment is added.

      Actual

      Nothing happens, and the browser console shows Uncaught TypeError: Cannot read properties of undefined (reading 'value').

      Cause

      The submit handler of the comment form in comments.js reads the comment from the first textarea of the form, after firing xwiki:actions:beforeSave to let the rich editor update its form fields:

      document.fire('xwiki:actions:beforeSave');
      if (form.down('textarea').value != "") {
      

      This works with CKEditor because it replaces a real textarea. BlockNote doesn't use a textarea: it outputs a div host plus hidden input fields, so form.down('textarea') is undefined. The comments JavaScript needs to read the submitted value in a way that doesn't depend on the editor, e.g. from the form field named after the comment property.

      Found while looking into XWIKI-25433, which would have CKEditor drop its textarea too in standalone edit mode.

      Attachments

        Issue Links

          Activity

            People

              pjeanjean Pierre Jeanjean
              pjeanjean Pierre Jeanjean
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: