finalize new media settings

This commit is contained in:
dswbx
2025-02-05 17:54:48 +01:00
parent 8418231c43
commit 46cf310ad6
12 changed files with 102 additions and 86 deletions

View File

@@ -38,10 +38,11 @@ export const Field = ({ name, schema: _schema, onChange, label: _label, hidden }
setValue(pointer, value as any);*/
const value = coerce(e.target.value, schema as any, { required });
//console.log("handleChange", pointer, e.target.value, { value });
if (typeof value === "undefined" && !required) {
//console.log("handleChange", pointer, e.target.value, { value }, ctx.options);
if (typeof value === "undefined" && !required && ctx.options?.keepEmpty !== true) {
ctx.deleteValue(pointer);
} else {
//console.log("setValue", pointer, value);
setValue(pointer, value);
}
}