From df7ac2dd458c9a9ad84bb0f9b6ac2b8842e8a16d Mon Sep 17 00:00:00 2001 From: Jakub Majorek Date: Thu, 1 Jul 2021 13:23:36 +0200 Subject: [PATCH] Fix rich text editor content not being saved (#1202) * Fix rich text editor content not being saved * Add a temporary workaround to EditorJS issue --- src/components/Attributes/AttributeRow.tsx | 5 ++++- src/components/Attributes/Attributes.tsx | 3 +++ src/components/RichTextEditor/RichTextEditor.tsx | 6 ++---- .../components/ProductVariantPage/ProductVariantPage.tsx | 2 ++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/Attributes/AttributeRow.tsx b/src/components/Attributes/AttributeRow.tsx index f684c1ecc..dfd47fdac 100644 --- a/src/components/Attributes/AttributeRow.tsx +++ b/src/components/Attributes/AttributeRow.tsx @@ -70,6 +70,7 @@ interface AttributeRowProps extends AttributeRowHandlers { disabled: boolean; error: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment; loading: boolean; + entityId: string; } const AttributeRow: React.FC = ({ @@ -85,7 +86,8 @@ const AttributeRow: React.FC = ({ onReferencesReorder, onChange, fetchAttributeValues, - fetchMoreAttributeValues + fetchMoreAttributeValues, + entityId }) => { const intl = useIntl(); const classes = useStyles({}); @@ -160,6 +162,7 @@ const AttributeRow: React.FC = ({ return ( ; title?: React.ReactNode; + entityId?: string; } const useStyles = makeStyles( @@ -116,6 +117,7 @@ const Attributes: React.FC = ({ attributeValues, errors, title, + entityId = "_defaultId", ...props }) => { const intl = useIntl(); @@ -162,6 +164,7 @@ const Attributes: React.FC = ({ {attributeIndex > 0 &&
} = ({ holder: editorContainer.current, logLevel: "ERROR" as LogLevels, onChange: async api => { - if (!api.readOnly) { - const savedData = await api.saver.save(); - onChange(savedData); - } + const savedData = await api.saver.save(); + onChange(savedData); }, onReady: () => { // FIXME: This throws an error and is not working diff --git a/src/products/components/ProductVariantPage/ProductVariantPage.tsx b/src/products/components/ProductVariantPage/ProductVariantPage.tsx index 1c7b5e6cb..322bbc9d7 100644 --- a/src/products/components/ProductVariantPage/ProductVariantPage.tsx +++ b/src/products/components/ProductVariantPage/ProductVariantPage.tsx @@ -227,6 +227,7 @@ const ProductVariantPage: React.FC = ({
@@ -248,6 +249,7 @@ const ProductVariantPage: React.FC = ({ />