Fix: RTE crash on defaultText change (#6789)

This commit is contained in:
ashit-rath 2021-08-25 19:41:15 +05:30 committed by GitHub
parent 8099a50832
commit aca4457a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -381,24 +381,31 @@ class CodeEditor extends Component<Props, State> {
const entityInformation: FieldEntityInformation = {
expectedType: expected?.autocompleteDataType,
};
if (dataTreePath) {
const { entityName, propertyPath } = getEntityNameAndPropertyPath(
dataTreePath,
);
entityInformation.entityName = entityName;
const entity = dynamicData[entityName];
if (entity && "ENTITY_TYPE" in entity) {
const entityType = entity.ENTITY_TYPE;
if (
entityType === ENTITY_TYPE.WIDGET ||
entityType === ENTITY_TYPE.ACTION
) {
entityInformation.entityType = entityType;
if (entity) {
if ("ENTITY_TYPE" in entity) {
const entityType = entity.ENTITY_TYPE;
if (
entityType === ENTITY_TYPE.WIDGET ||
entityType === ENTITY_TYPE.ACTION
) {
entityInformation.entityType = entityType;
}
}
if (isActionEntity(entity))
entityInformation.entityId = entity.actionId;
if (isWidgetEntity(entity))
entityInformation.entityId = entity.widgetId;
entityInformation.propertyPath = propertyPath;
}
if (isActionEntity(entity)) entityInformation.entityId = entity.actionId;
if (isWidgetEntity(entity)) entityInformation.entityId = entity.widgetId;
entityInformation.propertyPath = propertyPath;
}
return entityInformation;
};