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

including another jQuery causes color picker not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 5.12.0
    • 5.11.0
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      1. new a book
      2. click font color dropdown

      Current Result

      Uncaught TypeError: jq.colorpicker is not a constructor
      at Colorpicker.render (zss.wpd:12091:44)
      at HTMLDivElement.<anonymous> (zss.wpd:17616:18)
      at HTMLDivElement.dispatch (zk.wpd:4869:98)
      at elemData.handle (zk.wpd:4689:109)

      no color picker shows.

      Expected Result

      color picker pops up

      Debug Information

      • The testing page includes a different version of jQuery. The real use case is: a user uses keikai with Primesfaces which includes another jQuery.
      • When fixing this bug, please search for other jQuery plugins in keikai, and avoid the same problem in the future.

      Workaround

      jq-noConflict.js

      workaround

      bootstrap-colorpicker.js
      web/js/zss/ext/bootstrap-colorpicker.js

      (function webpackUniversalModuleDefinition(root, factory) {
      	if(typeof exports === 'object' && typeof module === 'object')
      		module.exports = factory(require("jquery"));
      	else if(typeof define === 'function' && define.amd)
      		define("bootstrap-colorpicker", ["jquery"], factory);
      	else if(typeof exports === 'object')
      		exports["bootstrap-colorpicker"] = factory(require("jquery"));
      	else
      		root["bootstrap-colorpicker"] = factory(jq); //KEIKAI-638 always use ZK jq to avoid register on another jQuery
      

        1. bootstrap-colorpicker.js
          160 kB
          hawk
        2. jq-noConflict.js
          0.1 kB
          hawk
        3. keikai-638.zul
          0.5 kB
          hawk

            DevChu DevChu
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: