mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-07 22:05:59 +01:00
Array: When there's only one row, the minus sign clears values in the fields instead of doing nothing
This commit is contained in:
@@ -97,11 +97,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ArrayField.prototype.remove = function(event) {
|
ArrayField.prototype.remove = function(event) {
|
||||||
if ($(event.target).closest('[data-grav-array-type="row"]').siblings().length == 0) {
|
var row = $(event.target).closest('[data-grav-array-type="row"]');
|
||||||
//disable for the last item
|
if (row.siblings().length == 0) {
|
||||||
|
//on the last item we just clear its values
|
||||||
|
row.find('input').val('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(event.target).closest('[data-grav-array-type="row"]').remove();
|
row.remove();
|
||||||
if (this.isValueOnly()) {
|
if (this.isValueOnly()) {
|
||||||
this.refreshAll();
|
this.refreshAll();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user