Thanks to visit codestin.com
Credit goes to git.drupalcode.org

Commit bce1ccc6 authored by Oleksandr Kuzava's avatar Oleksandr Kuzava
Browse files

Do not replace original button.

parent 40654535
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -7,6 +7,14 @@
  display: block !important;
}

.cloudinary-media-library-button.button.initiated {
  height: 1px !important;
  padding: 0 !important;
  width: 0 !important;
  position: absolute !important;
  visibility: hidden !important;
}

.cloudinary-media-library-button.button:hover,
.cloudinary-media-library-button.button:focus,
.cloudinary-media-library-button.button:active {
+10 −2
Original line number Diff line number Diff line
@@ -29,6 +29,14 @@
        $input.parent().find('.cloudinary-media-library-button').on('click', function (e) {
          e.preventDefault();

          // Check if there is already generated button by cloudinary, if so
          // we do not init the widget again and use the existing button.
          const $initiatedButton = $(this).parent().find('.initiated');
          if ($initiatedButton.length) {
            $initiatedButton.trigger('click');
            return;
          }

          // Display loading spinner.
          $input.after($(Drupal.theme('ajaxProgressThrobber')));

@@ -106,8 +114,8 @@
          const element = cloudinary.openMediaLibrary(options, handlers, this);
          element.inputId = $(this).closest('.js-form-item').find('input')[0].id;

          // Remove the custom button, the generated button will be used instead.
          $(this).remove();
          // Hide the cloudinary generated button to be used later.
          $(this).next().addClass('initiated');
        });
      });
    },