Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Style rich text editor
dominik-zeglencf7ce3b886a6
diff --git a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsxindex 90fbaae188..b0dc125820 100644--- a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx+++ b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx@@ -4,6 +4,8 @@ import {withStyles,WithStyles} from "@material-ui/core/styles";+import { fade } from "@material-ui/core/styles/colorManipulator";+import Typography from "@material-ui/core/Typography";import {BLOCK_TYPE,DraftailEditor,@@ -11,11 +13,13 @@ import {INLINE_STYLE} from "draftail";import * as React from "react";+import Link from "./Link";import LinkSource from "./LinkSource";export interface RichTextEditorProps {disabled: boolean;+ label: string;name: string;initial: string;onChange: (event: React.ChangeEvent<any>) => void;@@ -23,9 +27,81 @@ export interface RichTextEditorProps {const styles = (theme: Theme) =>createStyles({+ label: {+ marginBottom: theme.spacing.unit * 2+ },root: {- "& .Draftail-Toolbar": {- display: "flex"+ "& .DraftEditor": {+ "&-editorContainer": {+ "&:after": {+ background: theme.palette.primary.main,+ bottom: -1,+ content: "''",+ display: "block",+ height: 2,+ position: "absolute",+ transform: "scaleX(0)",+ transition: theme.transitions.duration.short + "ms",+ width: "100%"+ },+ "&:hover": {+ borderBottom: ``+ },+ borderBottom: `1px ${theme.palette.grey[500]} solid`,+ paddingBottom: theme.spacing.unit / 2,+ position: "relative"+ },+ "&-root": {+ ...theme.typography.body1+ }+ },+ "& .Draftail": {+ "&-Editor": {+ "&--focus": {+ "& .DraftEditor": {+ "&-editorContainer": {+ "&:after": {+ transform: "scaleX(1)"+ }+ }+ }+ }+ },+ "&-Toolbar": {+ "&Button": {+ "&--active": {+ "&:hover": {+ background: fade(theme.palette.secondary.main, 0.4)+ },++ background: fade(theme.palette.secondary.main, 0.3)+ },+ "&:hover": {+ background: fade(theme.palette.secondary.main, 0.1)+ },+ alignItems: "center",+ background: "none",+ border: "none",+ borderRadius: 4,+ cursor: "pointer",+ display: "inline-flex",+ height: 24,+ justifyContent: "center",+ marginLeft: theme.spacing.unit,+ marginRight: theme.spacing.unit,+ padding: 0,+ width: 24+ },+ "&Group": {+ display: "flex"+ },+ border: `1px ${theme.palette.grey[300]} solid`,+ borderRadius: 6,+ display: "flex",+ marginBottom: theme.spacing.unit,+ paddingBottom: theme.spacing.unit,+ paddingTop: theme.spacing.unit+ }}}});@@ -33,10 +109,14 @@ const RichTextEditor = withStyles(styles, { name: "RichTextEditor" })(({classes,initial,+ label,name,onChange}: RichTextEditorProps & WithStyles<typeof styles>) => (<div className={classes.root}>+ <Typography className={classes.label} variant="caption" color="primary">+ {label}+ </Typography><DraftailEditorrawContentState={initial || null}onSave={value =>diff --git a/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx b/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsxindex d028a8f4ae..020249915e 100644--- a/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx+++ b/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx@@ -5,6 +5,7 @@ import * as React from "react";import CardTitle from "../../../components/CardTitle";import FormSpacer from "../../../components/FormSpacer";+import RichTextEditor from "../../../components/RichTextEditor";import i18n from "../../../i18n";import { FormData } from "../PageDetailsPage";@@ -35,14 +36,11 @@ const PageInfo: React.StatelessComponent<PageInfoProps> = ({onChange={onChange}/><FormSpacer />- <TextField+ <RichTextEditordisabled={disabled}- error={!!errors.title}- fullWidth- helperText={errors.title}+ initial={data.content}label={i18n.t("Content")}- name={"title" as keyof FormData}- value={data.content}+ name={"content" as keyof FormData}onChange={onChange}/></CardContent>diff --git a/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx b/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsxindex 69d3db3d65..53b882ea52 100644--- a/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx@@ -17,6 +17,7 @@ storiesOf("Generics / Rich text editor", module)<RichTextEditordisabled={false}initial={data.content}+ label="Content"name="content"onChange={change}/>