X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/fbedc8f26f2879a46629edc72ce20e3e85135523..f769689fb6c21d76aa70f4113ba918e45b528576:/src/redakcja/static/js/wiki/view_properties.js diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index 204a4dec..e38a7d07 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -8,6 +8,7 @@ "attributes": [ { "name": "src", + "type": "media", }, { "name": "alt", @@ -151,6 +152,27 @@ }); + $('#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 = $("").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'); + }); self.$pane.on('click', '.current-convert', function() { self.convert($(this).attr('data-to')); @@ -334,22 +356,28 @@ let $fg = $("
"); $("