|
|
@@ -1,7 +1,8 @@
|
|
|
-import { Button, Dropdown, MenuProps, message } from "antd";
|
|
|
+import { Button, Dropdown, MenuProps, message, notification } from "antd";
|
|
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
|
|
import { fullUrl } from "../../utils";
|
|
|
import { useIntl } from "react-intl";
|
|
|
+import { addToCart } from "./SentEdit/SentCart";
|
|
|
|
|
|
interface IWidgetParaHandleCtl {
|
|
|
book: number;
|
|
|
@@ -34,12 +35,21 @@ export const ParaHandleCtl = ({
|
|
|
id: "labels.curr.paragraph.open",
|
|
|
}),
|
|
|
},
|
|
|
+ {
|
|
|
+ type: "divider",
|
|
|
+ },
|
|
|
{
|
|
|
key: "copy-sent",
|
|
|
label: intl.formatMessage({
|
|
|
id: "labels.curr.paragraph.copy.tpl",
|
|
|
}),
|
|
|
},
|
|
|
+ {
|
|
|
+ key: "cart-sent",
|
|
|
+ label: intl.formatMessage({
|
|
|
+ id: "labels.curr.paragraph.cart.tpl",
|
|
|
+ }),
|
|
|
+ },
|
|
|
{
|
|
|
key: "quote-link-tpl",
|
|
|
label: intl.formatMessage({
|
|
|
@@ -103,6 +113,15 @@ export const ParaHandleCtl = ({
|
|
|
case "copy-sent":
|
|
|
copyToClipboard(sentences.map((item) => `{{${item}}}`).join(""));
|
|
|
break;
|
|
|
+ case "cart-sent":
|
|
|
+ const cartData = sentences.map((item) => {
|
|
|
+ return { id: `{{${item}}}`, text: `{{${item}}}` };
|
|
|
+ });
|
|
|
+ addToCart(cartData);
|
|
|
+ notification.success({
|
|
|
+ message: cartData.length + "个句子已经添加到Cart",
|
|
|
+ });
|
|
|
+ break;
|
|
|
case "quote-link-tpl-c":
|
|
|
copyToClipboard(`{{ql|type=c|book=${book}|para=${para}}}`);
|
|
|
break;
|