Skip to content
Snippets Groups Projects
Commit fc03ed6e authored by Oleksandr Kuzava's avatar Oleksandr Kuzava
Browse files

Improve widget openning.

parent 9c79c146
No related branches found
No related tags found
No related merge requests found
......@@ -4,15 +4,6 @@
color: #ffffff !important;
text-shadow: none !important;
border: none !important;
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,
......
......@@ -29,14 +29,6 @@
$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')));
......@@ -111,11 +103,8 @@
}
};
const element = cloudinary.openMediaLibrary(options, handlers, this);
const element = cloudinary.openMediaLibrary(options, handlers);
element.inputId = $(this).closest('.js-form-item').find('input')[0].id;
// Hide the cloudinary generated button to be used later.
$(this).next().addClass('initiated');
});
});
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment