Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-329

Including a different jQuery version library causes an error when inserting a comment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Later Later
    • 5.4.0
    • 5.3.0
    • None
    • Security Level: Jimmy
    • None
    • None

      steps to reproduce

      1. load the attached zul
      2. insert a comment with the context menu

      current result

      TypeError: jq(...).cleditor is not a function
      zssex.Richtextbox<._init()
      zssex.wpd:19
      zssex.Richtextbox<.bind_/<()
      zssex.wpd:19
      zssex.wpd:19:118

      Because js file loading order might be different from time to time, this issue sometimes doesn't happen. You need to reload the page several times to reproduce it.

      expected result

      no error

      root cause

      • the jQuery object passed to CLEditor plugin might be another version of jQuery instead of zk bundled jQuery depending on js file loading order. So the function cleditor() might not be availiable on jq

      solution

      always pass jq to CLEditor plugin to avoid being overridden by another jQuery library. In the last line of jqery.cleditor.js, replace jQuery with jq. Plese refer to attached jqery.cleditor.js

      (function ($) {
      
          //==============
          // jQuery Plugin
          //==============
      
          $.cleditor = {
              //...
          }
      
      })(jq);
      

      workaround

      call noConflict(). Please refer to jq-noConflict.js

        1. 1302.zul
          0.4 kB
        2. jq-noConflict.js
          0.0 kB
        3. jquery.cleditor.js
          43 kB

            wenninghsu wenninghsu
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: