Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-54345

TinyMCE patch relies on jQuery being exposed under $ in global scope

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Medium
    • None

    Description

      It seems that a change on Quirks.js which is relying on jQuery being exposed on $ in global scope has made it into the latest 5.2-OD-13-1 release.

      // ATLASSIAN
      // Extracted manually from tinymce commit 8e6422aefa9b6cc526a218559eaf036f1d2868cf to prevent CONFDEV-16789
      // Mark all the existent spans in the parent element, and delete any extra one that gets created
      // after the delete operation, since that one has been added by the browser.
      
      tinymce.each($(blocks).find('span'), function(span) {
          span.setAttribute('data-mce-mark', '1');
      });
      

      The $ variable is not set on the closure, thus relying on global scope. This is problematic in that the jQuery version we should be relying on, the one from the Atlassian JavaScript framework, is exposed only under AJS.$ in global scope. The only reason why $ works is because something else is leaking it. I assume this is a copy & paste mistake, as in fact the normal practice would be to expose AJS.$ as $ in the closure. If jQuery is not provided under $, the script fails with:

      Uncaught TypeError: Property '$' of object [object Object] is not a function tinymce-util-Quirks.js:64
      (anonymous function) tinymce-util-Quirks.js:64
      tinymce.create.dispatch tinymce-util-Dispatcher.js:102
      eventHandler tinymce-Editor.js:2990
      cb
      

      resulting in the delete and backspace key not working in the editor.

      Attachments

        Issue Links

          Activity

            People

              don.willis@atlassian.com Don Willis
              fakraemer fabs
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: