mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed drag-n-drop reorder of gallery images not responding to drops
no issue - https://github.com/TryGhost/Ghost-Admin/pull/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
This commit is contained in:
parent
f743697450
commit
00ee6ebedd
1 changed files with 8 additions and 5 deletions
|
@ -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) => {
|
||||
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue