Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Afform - Drag & drop fixes #20263

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/afform/admin/ang/afGuiEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
$('#af-gui-icon-picker').crmIconPicker();
});
// Add css class while dragging
$('#crm-container')
$(document)
.on('sortover', function(e) {
$('.af-gui-container').removeClass('af-gui-dragtarget');
$(e.target).closest('.af-gui-container').addClass('af-gui-dragtarget');
Expand All @@ -192,7 +192,7 @@
.on('sortstart', '#afGuiEditor', function() {
$('#afGuiEditor').addClass('af-gui-dragging');
})
.on('sortstop', '#afGuiEditor', function() {
.on('sortstop', function() {
$('.af-gui-dragging').removeClass('af-gui-dragging');
$('.af-gui-dragtarget').removeClass('af-gui-dragtarget');
});
Expand Down
4 changes: 2 additions & 2 deletions ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@
$target = $(sort.droptarget[0]),
$item = $(ui.item[0]);
// Fields cannot be dropped outside their own entity
if ($item.is('[af-gui-field]') || $item.has('[af-gui-field]').length) {
if ($item.find('af-gui-field').length) {
if ($source.closest('[data-entity]').attr('data-entity') !== $target.closest('[data-entity]').attr('data-entity')) {
return sort.cancel();
}
}
// Entity-fieldsets cannot be dropped into other entity-fieldsets
if ((sort.model['af-fieldset'] || $item.has('.af-gui-fieldset').length) && $target.closest('.af-gui-fieldset').length) {
if ((sort.model['af-fieldset'] || $item.find('.af-gui-fieldset').length) && $target.closest('.af-gui-fieldset').length) {
return sort.cancel();
}
}
Expand Down