Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82724

TinyMCE adding quicktoolbar function throws error when quicktoolbar is disabled

XMLWordPrintable

      In some situations the quicktoolbar of TinyMCE seems to be disabled. This happens especially when the editor text area has only a few lines (for example the introeditor in mod_resource).

      When there is a tiny plugin trying to add items to the quicktoolbar in this case, tiny throws an error in the console and does not load.

      Reason is that the check here https://github.com/moodle/moodle/blob/8a6e8563fdc9e9684ab628ea0274fd2277bc5265/lib/editor/tiny/amd/src/utils.js#L217 only works if the quicktoolbar object is null or undefined, but not, if it's false, which however seems to be the case for example in the introeditor when adding a mod_resource activity.

      Yes, the plugins of course can do the check on their own. But the addQuickbarsToolbarItem function tries to do a check and I feel like it should also catch the case of quicktoolbar === false

      Same for contextmenu.

       

      To reproduce:

      • As admin go to admin/settings.php?section=editorsettingstiny
      • Enable "no auto-link" plugin
      • Create a course
      • Add activity "File"
      • See that the intro editor is not loading and you have an error in the JS console

            phmemmel PhMemmel
            phmemmel PhMemmel
            Meirza Meirza
            Huong Nguyen Huong Nguyen
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 26 minutes
                3h 26m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.