+ 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('');
+ $.each(self.doc.galleryImages, (i, imgItem) => {
+ 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');
+ });
+
+ /* Meta chooser */
+ $('#meta-chooser').on('show.bs.modal', function (event) {
+ let input = $("input", $(event.relatedTarget).closest('.input-group'));
+ let $fg = $(event.relatedTarget).closest('.form-group');
+ let field = $fg.data('field');
+ let modal = $(this);