fix(dashboard): Allow using enter key to create newline in Textarea (#9913)
* fix(dashboard):Allow using enter key to create newline in Textarea * update scheam file
This commit is contained in:
committed by
GitHub
parent
c0368cca28
commit
d19d7a66ff
@@ -14,6 +14,13 @@ export const KeyboundForm = React.forwardRef<
|
|||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => {
|
const handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
|
if (
|
||||||
|
event.target instanceof HTMLTextAreaElement &&
|
||||||
|
!(event.metaKey || event.ctrlKey)
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
if (event.metaKey || event.ctrlKey) {
|
if (event.metaKey || event.ctrlKey) {
|
||||||
|
|||||||
@@ -1555,6 +1555,26 @@
|
|||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
"edit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"header": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"successToast": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"header",
|
||||||
|
"description",
|
||||||
|
"successToast"
|
||||||
|
],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1894,9 +1914,6 @@
|
|||||||
"attributes": {
|
"attributes": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"editProduct": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"editAttributes": {
|
"editAttributes": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -2667,13 +2684,13 @@
|
|||||||
"required": [
|
"required": [
|
||||||
"domain",
|
"domain",
|
||||||
"list",
|
"list",
|
||||||
|
"edit",
|
||||||
"create",
|
"create",
|
||||||
"export",
|
"export",
|
||||||
"import",
|
"import",
|
||||||
"deleteWarning",
|
"deleteWarning",
|
||||||
"variants",
|
"variants",
|
||||||
"attributes",
|
"attributes",
|
||||||
"editProduct",
|
|
||||||
"editAttributes",
|
"editAttributes",
|
||||||
"editOptions",
|
"editOptions",
|
||||||
"editPrices",
|
"editPrices",
|
||||||
|
|||||||
@@ -380,6 +380,11 @@
|
|||||||
"list": {
|
"list": {
|
||||||
"noRecordsMessage": "Create your first product to start selling."
|
"noRecordsMessage": "Create your first product to start selling."
|
||||||
},
|
},
|
||||||
|
"edit": {
|
||||||
|
"header": "Edit Product",
|
||||||
|
"description": "Edit the product details.",
|
||||||
|
"successToast": "Product {{title}} was successfully updated."
|
||||||
|
},
|
||||||
"create": {
|
"create": {
|
||||||
"header": "General",
|
"header": "General",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
@@ -462,7 +467,6 @@
|
|||||||
"deleteWarning": "You are about to delete the product {{title}}. This action cannot be undone.",
|
"deleteWarning": "You are about to delete the product {{title}}. This action cannot be undone.",
|
||||||
"variants": "Variants",
|
"variants": "Variants",
|
||||||
"attributes": "Attributes",
|
"attributes": "Attributes",
|
||||||
"editProduct": "Edit Product",
|
|
||||||
"editAttributes": "Edit Attributes",
|
"editAttributes": "Edit Attributes",
|
||||||
"editOptions": "Edit Options",
|
"editOptions": "Edit Options",
|
||||||
"editPrices": "Edit prices",
|
"editPrices": "Edit prices",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Input, Select, Text, Textarea } from "@medusajs/ui"
|
import { Button, Input, Select, Text, Textarea, toast } from "@medusajs/ui"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import * as zod from "zod"
|
import * as zod from "zod"
|
||||||
|
|
||||||
@@ -69,9 +69,15 @@ export const EditProductForm = ({ product }: EditProductFormProps) => {
|
|||||||
...nullableData,
|
...nullableData,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: ({ product }) => {
|
||||||
|
toast.success(
|
||||||
|
t("products.edit.successToast", { title: product.title })
|
||||||
|
)
|
||||||
handleSuccess()
|
handleSuccess()
|
||||||
},
|
},
|
||||||
|
onError: (e) => {
|
||||||
|
toast.error(e.message)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ export const ProductEdit = () => {
|
|||||||
<RouteDrawer>
|
<RouteDrawer>
|
||||||
<RouteDrawer.Header>
|
<RouteDrawer.Header>
|
||||||
<RouteDrawer.Title asChild>
|
<RouteDrawer.Title asChild>
|
||||||
<Heading>{t("products.editProduct")}</Heading>
|
<Heading>{t("products.edit.header")}</Heading>
|
||||||
</RouteDrawer.Title>
|
</RouteDrawer.Title>
|
||||||
|
<RouteDrawer.Description className="sr-only">
|
||||||
|
{t("products.edit.description")}
|
||||||
|
</RouteDrawer.Description>
|
||||||
</RouteDrawer.Header>
|
</RouteDrawer.Header>
|
||||||
{!isLoading && product && <EditProductForm product={product} />}
|
{!isLoading && product && <EditProductForm product={product} />}
|
||||||
</RouteDrawer>
|
</RouteDrawer>
|
||||||
|
|||||||
Reference in New Issue
Block a user