Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Fixed drag-n-drop reorder of gallery images not responding to drops
Browse files Browse the repository at this point in the history
no issue
- #1081 introduced a bug where the `insertIndex` was being cleared every time we showed the drop position indicator because we hide the indicator as a reset every time we show the indicator. This meant every drop was missing the required insertIndex.
- added a flag to the `_hideDropIndicator` function so that a reset when showing the indicator doesn't clear the required information
  • Loading branch information
kevinansfield committed Dec 11, 2018
1 parent 23fa35c commit 5afdb55
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/koenig-editor/addon/services/koenig-drag-drop-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ export default Service.extend({
_showDropIndicator({direction, position, beforeElems, afterElems}) {
let dropIndicator = this._dropIndicator;

// reset everything before re-displaying indicator
this._hideDropIndicator();
// reset everything except insertIndex before re-displaying indicator
this._hideDropIndicator({clearInsertIndex: false});

if (direction === 'horizontal') {
beforeElems.forEach((elem) => {
Expand Down Expand Up @@ -405,12 +405,15 @@ export default Service.extend({
// TODO: handle vertical drag/drop
},

_hideDropIndicator() {
_hideDropIndicator({clearInsertIndex = true} = {}) {
// make sure the indicator isn't shown due to a running timeout
run.cancel(this._dropIndicatorTimeout);

// clear droppable insert index
delete this.draggableInfo.insertIndex;
// clear droppable insert index unless instructed not to (eg, when
// resetting the display before re-positioning the indicator)
if (clearInsertIndex) {
delete this.draggableInfo.insertIndex;
}

// reset all transforms
this._transformedDroppables.forEach((elem) => {
Expand Down

0 comments on commit 5afdb55

Please sign in to comment.