Skip to content

Commit

Permalink
Fixed trigger reselect image popup when reorder images.
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Jul 21, 2017
1 parent 58c8bbd commit 7f9915c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions js/media.js
Expand Up @@ -320,22 +320,14 @@ jQuery( function ( $ ) {
initSortable: function () {
var collection = this.controller.get( 'items' );
this.$el.sortable( {
// Change the position of the attachment as soon as the
// mouse pointer overlaps a thumbnail.
tolerance: 'pointer',
// Clone the element and the clone will be dragged. Prevent trigger click on the image, which means reselect.
helper : 'clone',

// Record the initial `index` of the dragged model.
start: function ( event, ui ) {
ui.item.data( 'sortableIndexStart', ui.item.index() );
},

// Stop trigger 'click' on item. 'click' means reselect.
stop: function ( event ) {
$( event.originalEvent.target ).one( 'click', function ( e ) {
e.stopImmediatePropagation();
} );
},

// Update the model's index in the collection.
// Do so silently, as the view is already accurate.
update: function ( event, ui ) {
Expand Down

0 comments on commit 7f9915c

Please sign in to comment.