+ self.$pane.on('click', '.meta-delete', function() {
+ let $fg = $(this).closest('.form-group');
+ let $ig = $(this).closest('.input-group');
+ $('input', $ig).data('edited').remove();
+ self.displayMetaProperty($fg);
+ $.wiki.perspectives.VisualPerspective.flush();
+ return false;
+ });
+
+ $('#media-chooser').on('show.bs.modal', function (event) {
+ var input = $("input", $(event.relatedTarget).parent());
+ var modal = $(this);
+ modal.data('target-input', input);
+ var imglist = modal.find('.modal-body');
+ imglist.html('');
+
+ self.doc.refreshImageGallery({
+ success: function(galleryImages) {
+ $.each(self.doc.galleryImages, (i, imgItem) => {
+ let img = $("<img>").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
+ imglist.find('img').removeClass('active');
+ $(this).addClass('active');
+ });
+ imglist.append(img);
+ });
+ }
+ });
+ })
+ $('#media-chooser .ctrl-ok').on('click', function (event) {
+ $('#media-chooser').data('target-input')
+ .val(
+ (new URL($('#media-chooser .active').data('url'), document.baseURI)).href
+ ).trigger('change');
+ $('#media-chooser').modal('hide');
+ });