When using the "only translate empty fields" option, rich text Lexical fields that are empty (but not undefined) are not translated.
The traverseField function only checks whether a rich text field is defined, but it does not verify if the field is empty. A rich text field can become empty when it previously had content but was later cleared via the UI. In such cases, the field is stored in the database with the following JSON structure:
{
"root": {
"children": [
{
"children": [],
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"version": 1,
"textFormat": 0,
"textStyle": ""
}
],
"direction": null,
"format": "",
"indent": 0,
"type": "root",
"version": 1
}
}
Since the field is not undefined, it is not considered empty, and therefore, it does not get translated when the emptyOnly option is enabled.
Expected Behavior: Rich text fields that are effectively empty (i.e., contain no user-entered content) should be considered empty and translated when using the emptyOnly option.
When using the "only translate empty fields" option, rich text Lexical fields that are empty (but not undefined) are not translated.
The
traverseFieldfunction only checks whether a rich text field is defined, but it does not verify if the field is empty. A rich text field can become empty when it previously had content but was later cleared via the UI. In such cases, the field is stored in the database with the following JSON structure:Since the field is not
undefined, it is not considered empty, and therefore, it does not get translated when theemptyOnlyoption is enabled.Expected Behavior: Rich text fields that are effectively empty (i.e., contain no user-entered content) should be considered empty and translated when using the
emptyOnlyoption.