Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Restyle link source
dominik-zeglen84e003b84a38
diff --git a/saleor/static/dashboard-next/components/RichTextEditor/LinkSource.tsx b/saleor/static/dashboard-next/components/RichTextEditor/LinkSource.tsxindex f3339f75e2..27e5118302 100644--- a/saleor/static/dashboard-next/components/RichTextEditor/LinkSource.tsx+++ b/saleor/static/dashboard-next/components/RichTextEditor/LinkSource.tsx@@ -1,6 +1,15 @@+import Button from "@material-ui/core/Button";+import Dialog from "@material-ui/core/Dialog";+import DialogActions from "@material-ui/core/DialogActions";+import DialogContent from "@material-ui/core/DialogContent";+import DialogTitle from "@material-ui/core/DialogTitle";+import TextField from "@material-ui/core/TextField";import { EditorState, EntityInstance, RichUtils } from "draft-js";import * as React from "react";+import i18n from "../../i18n";+import Form from "../Form";+interface LinkSourceProps {editorState: EditorState;entity?: EntityInstance;@@ -8,13 +17,12 @@ interface LinkSourceProps {type: string;};onComplete: (updateState: EditorState) => void;+ onClose: () => void;}class LinkSource extends React.Component<LinkSourceProps> {- componentDidMount() {- const { editorState, entity, entityType, onComplete } = this.props;-- const href = window.prompt("Link URL", entity ? entity.getData().href : "");+ submit = (href: string) => {+ const { editorState, entityType, onComplete } = this.props;if (href) {const content = editorState.getCurrentContent();@@ -37,10 +45,43 @@ class LinkSource extends React.Component<LinkSourceProps> {} else {onComplete(editorState);}- }+ };render() {- return null;+ const { entity, onClose } = this.props;+ const initial = entity ? entity.getData().href : "";++ return (+ <Dialog open={true} fullWidth maxWidth="sm">+ <Form+ initial={{ href: initial }}+ onSubmit={({ href }) => this.submit(href)}+ >+ {({ data, change, submit }) => (+ <>+ <DialogTitle>{i18n.t("Add or Edit Link")}</DialogTitle>+ <DialogContent>+ <TextField+ name="href"+ fullWidth+ label={i18n.t("URL Linked")}+ value={data.href}+ onChange={change}+ />+ </DialogContent>+ <DialogActions>+ <Button onClick={onClose}>+ {i18n.t("Cancel", { context: "button" })}+ </Button>+ <Button onClick={submit} color="secondary" variant="contained">+ {i18n.t("Save", { context: "button" })}+ </Button>+ </DialogActions>+ </>+ )}+ </Form>+ </Dialog>+ );}}export default LinkSource;