Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add default state to rich text editor

dominik-zeglen38ddd5a51464
diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
index b35773669f..0177f68e2b 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
@@ -1,4 +1,4 @@
-import { RawDraftContentState } from "draft-js";
+import { ContentState, convertToRaw, RawDraftContentState } from "draft-js";
import * as React from "react";
import AppHeader from "@saleor/components/AppHeader";
@@ -21,7 +21,7 @@ interface FormData {
}
const initialData: FormData = {
- description: null,
+ description: convertToRaw(ContentState.createFromText("")),
name: "",
seoDescription: "",
seoTitle: ""
diff --git a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
index 6c943d8079..46cc82bf0d 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
@@ -1,6 +1,6 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
-import { RawDraftContentState } from "draft-js";
+import { ContentState, convertToRaw, RawDraftContentState } from "draft-js";
import * as React from "react";
import AppHeader from "@saleor/components/AppHeader";
@@ -47,7 +47,7 @@ const initialForm: CollectionCreatePageFormData = {
value: null
},
backgroundImageAlt: "",
- description: null,
+ description: convertToRaw(ContentState.createFromText("")),
isPublished: false,
name: "",
publicationDate: "",