[TASK] Uses single-asset insertion when only one asset has been selected to be inserted
See #651. Backported from master branch. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
d319ad16f1
commit
a45c545ee3
@ -10,6 +10,12 @@ Version 2.3.3-beta1 ()
|
|||||||
published blog entries and ability to prepend a mail body.
|
published blog entries and ability to prepend a mail body.
|
||||||
Also fixes missing "keep strip tags" configuration option
|
Also fixes missing "keep strip tags" configuration option
|
||||||
|
|
||||||
|
* #651: When using checkboxes to insert multiple media files, if only
|
||||||
|
one asset has been selected, do not use the gallery mode,
|
||||||
|
but instead single-asset view. Also improves to click the title
|
||||||
|
of an asset to select its checkbox, and hides the 'Insert all'
|
||||||
|
button when no assets are selected. (garvinhicking)
|
||||||
|
|
||||||
* Fix: [bbcode] Get roman numerals working in bbcode plugin.
|
* Fix: [bbcode] Get roman numerals working in bbcode plugin.
|
||||||
Thanks to Fabien Chabreuil!
|
Thanks to Fabien Chabreuil!
|
||||||
|
|
||||||
|
@ -1387,8 +1387,39 @@ $(function() {
|
|||||||
$('.multidelete, .multiinsert').click(function() {
|
$('.multidelete, .multiinsert').click(function() {
|
||||||
var $el = $(this);
|
var $el = $(this);
|
||||||
serendipity.highlightComment($el.attr('data-multidelid'), $el.attr('checked'));
|
serendipity.highlightComment($el.attr('data-multidelid'), $el.attr('checked'));
|
||||||
$('#media_galleryinsert').fadeIn();
|
var selectionAmount = $('.multidelete:checked, .multiinsert:checked').length;
|
||||||
|
if (selectionAmount > 0) {
|
||||||
|
$('#media_galleryinsert').fadeIn();
|
||||||
|
} else {
|
||||||
|
$('#media_galleryinsert').fadeOut();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Also marks checkbox when header is clicked
|
||||||
|
$('.media_file h3').on('click', function() {
|
||||||
|
$(this).parent().find('.multiinsert').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
// When clicking the 'Insert all' button, check whether only one or multiple
|
||||||
|
// images are selected
|
||||||
|
$('#media_galleryinsert .image_insert').on('click', function(e) {
|
||||||
|
var selectionAmount = $('.multidelete:checked, .multiinsert:checked').length;
|
||||||
|
if (selectionAmount == 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually do a single insert
|
||||||
|
if (selectionAmount == 1) {
|
||||||
|
e.preventDefault();
|
||||||
|
var actualTargetElement = $('.multidelete:checked, .multiinsert:checked').closest('.media_file').find('.media_file_preview a').first();
|
||||||
|
// This below is a hack. Triggering actualTargetElement.click() does not work. Probably because MFP overrides click events within a modal popup.
|
||||||
|
// So we need to do something dirty and directly access the location href. Don't tell my mom.
|
||||||
|
location.href = actualTargetElement.attr('href');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// hide gallery insert button until an image is selected
|
// hide gallery insert button until an image is selected
|
||||||
$('#media_galleryinsert').hide();
|
$('#media_galleryinsert').hide();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user