fix(richtext-*): extra fields not being iterated correctly (#3693)
This commit is contained in:
@@ -23,7 +23,9 @@ export function transformExtraFields(
|
||||
|
||||
// Wrap fields which are not part of the base schema in a group named 'fields' - otherwise they will be rendered but not saved
|
||||
const extraFields = []
|
||||
fields.forEach((field) => {
|
||||
for (let i = fields.length - 1; i >= 0; i--) {
|
||||
const field = fields[i]
|
||||
|
||||
if ('name' in field) {
|
||||
if (
|
||||
!baseFields.find((baseField) => !('name' in baseField) || baseField.name === field.name)
|
||||
@@ -35,7 +37,7 @@ export function transformExtraFields(
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Array.isArray(customFieldSchema) || fields.length > 0) {
|
||||
// find field with name 'fields' and add the extra fields to it
|
||||
|
||||
@@ -64,7 +64,9 @@ export function transformExtraFields(
|
||||
|
||||
// Wrap fields which are not part of the base schema in a group named 'fields' - otherwise they will be rendered but not saved
|
||||
const extraFields = []
|
||||
fields.forEach((field) => {
|
||||
for (let i = fields.length - 1; i >= 0; i--) {
|
||||
const field = fields[i]
|
||||
|
||||
if ('name' in field) {
|
||||
if (
|
||||
!baseFields.find((baseField) => !('name' in baseField) || baseField.name === field.name)
|
||||
@@ -76,7 +78,7 @@ export function transformExtraFields(
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Array.isArray(customFieldSchema) || fields.length > 0) {
|
||||
fields.push({
|
||||
|
||||
Reference in New Issue
Block a user