[oform] Check for unused fields at the end of the action

This commit is contained in:
KirillovIlya
2022-12-07 15:01:11 +03:00
parent 0be878b888
commit f0ea4cfe24
2 changed files with 13 additions and 0 deletions

View File

@ -479,6 +479,15 @@
this.removeFieldMasterByIndex(fieldIndex);
}
};
CDocument.prototype.removeUnusedFieldMasters = function()
{
for (let fieldIndex = this.FieldMasters.length - 1; fieldIndex >= 0; --fieldIndex)
{
let fieldMaster = this.FieldMasters[fieldIndex];
if (!fieldMaster.isUseInDocument())
this.removeFieldMasterByIndex(fieldIndex);
}
};
//--------------------------------------------------------export----------------------------------------------------
AscOForm.CDocument = CDocument;

View File

@ -475,6 +475,10 @@
api.sendEvent("asc_onUpdateOFormRoles", this.Roles);
};
OForm.prototype.onEndAction = function()
{
this.Format.removeUnusedFieldMasters();
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////