Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / image_widget_crop / js / ImageWidgetCropType.js
index f9c376b6e2c853324738128598784381c2ea2354..5ca293b358fe822ae9822a5e55031920a3066d0b 100644 (file)
   Drupal.ImageWidgetCropType.prototype.selectors = {
     image: '[data-drupal-iwc=image]',
     reset: '[data-drupal-iwc=reset]',
-    table: '[data-drupal-iwc=table]', // @todo is this even used anymore?
+    table: '[data-drupal-iwc=table]',
     values: {
       applied: '[data-drupal-iwc-value=applied]',
       height: '[data-drupal-iwc-value=height]',
       .one('visible.iwc', this.initializeCropper.bind(this))
       .on('hidden.iwc', function () {
         this.visible = false;
-      }.bind(this))
-    ;
+      }.bind(this));
 
     this.$reset
-      .on('click.iwc', this.reset.bind(this))
-    ;
+      .on('click.iwc', this.reset.bind(this));
 
     // Star polling visibility of the image that should be able to be cropped.
     this.pollVisibility(this.$image);
 
     // Trigger the initial summaryUpdate event.
     this.$wrapper.trigger('summaryUpdated');
+    var isIE = /*@cc_on!@*/false || !!document.documentMode;
+    if (isIE) {
+      var $image = this.$image;
+      $('.image-data__crop-wrapper > summary').on('click', function () {
+        setTimeout(function () {$image.trigger('visible.iwc')}, 100);
+      });
+    }
   };
 
   /**
       .on('built.iwc.cropper', this.built.bind(this))
       .on('cropend.iwc.cropper', this.cropEnd.bind(this))
       .on('cropmove.iwc.cropper', this.cropMove.bind(this))
-      .cropper(this.options)
-    ;
+      .cropper(this.options);
 
     this.cropper = this.$image.data('cropper');
     this.options = this.cropper.options;
    * @param {HTMLElement|jQuery} element
    *   The element to poll.
    *
-   * @todo Perhaps replace once vertical tabs have proper events?
-   *
-   * @see https://www.drupal.org/node/2653570
+   * Replace once vertical tabs have proper events ?
+   * When following issue are fixed @see https://www.drupal.org/node/2653570.
    */
   Drupal.ImageWidgetCropType.prototype.pollVisibility = function (element) {
     var $element = $(element);
     if (!this.values.hasOwnProperty(name) || !this.values[name][0]) {
       return;
     }
-    value = value ? parseInt(value, 10) : 0;
+    value = value ? parseFloat(value) : 0;
     if (delta && name !== 'applied') {
       value = Math.round(value * delta);
     }