Browse Source

Fix Sorter usage in StyleManager (#6123)

* Fix Sorter usage in StyleManager.

* Run formatter
pull/6133/head
mohamed yahia 1 year ago
committed by GitHub
parent
commit
211f17ac6c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      packages/core/src/utils/Sorter.ts

9
packages/core/src/utils/Sorter.ts

@ -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');

Loading…
Cancel
Save