Skip to content

Commit

Permalink
Fix Sorter usage in StyleManager (#6123)
Browse files Browse the repository at this point in the history
* Fix Sorter usage in StyleManager.

* Run formatter
  • Loading branch information
mohamedsalem401 authored Sep 5, 2024
1 parent 9a6fa0c commit 211f17a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/utils/Sorter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,14 @@ export default class Sorter extends View {
return result;
}

const index = pos ? (pos.method === 'after' ? pos.indexEl + 1 : pos.indexEl) : trgModel.components().length;
let length = -1;
const isCollection = trgModel instanceof Collection;
if (isFunction(trgModel.components)) {
length = trgModel.components().length;
} else if (isCollection) {
length = trgModel.models.length;
}
const index = pos ? (pos.method === 'after' ? pos.indexEl + 1 : pos.indexEl) : length;

// Check if the source is draggable in target
let draggable = srcModel.get('draggable');
Expand Down

0 comments on commit 211f17a

Please sign in to comment.