From 943b73dfbd088c561ca50133c48582cb8b09995d Mon Sep 17 00:00:00 2001
From: fzk <458813868@qq.com>
Date: Fri, 11 Oct 2024 09:12:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BDmarkdown?=
=?UTF-8?q?=E5=92=8Chtml?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
component/items/downloadHtml.tsx | 25 +++++++++++++++++
component/items/downloadMarkdown.tsx | 25 +++++++++++++++++
component/options/51cto.tsx | 35 ++++--------------------
component/options/baidu.tsx | 32 +++-------------------
component/options/cnblogs.tsx | 33 +++--------------------
component/options/csdn.tsx | 33 +++--------------------
component/options/jb51.tsx | 33 +++--------------------
component/options/jianshu.tsx | 33 +++--------------------
component/options/juejin.tsx | 40 +++-------------------------
component/options/oschina.tsx | 34 +++--------------------
component/options/php.tsx | 33 +++--------------------
component/options/segmentfault.tsx | 18 +++----------
component/options/sortableItem.tsx | 2 --
component/options/weixin.tsx | 33 +++--------------------
component/options/zhihu.tsx | 33 +++--------------------
package.json | 2 +-
16 files changed, 100 insertions(+), 344 deletions(-)
create mode 100644 component/items/downloadHtml.tsx
create mode 100644 component/items/downloadMarkdown.tsx
diff --git a/component/items/downloadHtml.tsx b/component/items/downloadHtml.tsx
new file mode 100644
index 0000000..a370a4d
--- /dev/null
+++ b/component/items/downloadHtml.tsx
@@ -0,0 +1,25 @@
+import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
+
+import { sendToContentScript } from "@plasmohq/messaging"
+
+import { i18n } from "~tools"
+
+export default function DownloadHtml(props) {
+ let { name } = props
+
+ async function downloadHtml() {
+ sendToContentScript({
+ name: `${name}-downloadHtml`
+ })
+ }
+
+ return (
+
+
+
+ {i18n("downloadHtml")}
+
+
+
+ )
+}
diff --git a/component/items/downloadMarkdown.tsx b/component/items/downloadMarkdown.tsx
new file mode 100644
index 0000000..45df28a
--- /dev/null
+++ b/component/items/downloadMarkdown.tsx
@@ -0,0 +1,25 @@
+import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
+
+import { sendToContentScript } from "@plasmohq/messaging"
+
+import { i18n } from "~tools"
+
+export default function EditMarkdown(props) {
+ let { name } = props
+
+ async function downloadMarkdown() {
+ sendToContentScript({
+ name: `${name}-downloadMarkdown`
+ })
+ }
+
+ return (
+
+
+
+ {i18n("downloadMarkdown")}
+
+
+
+ )
+}
diff --git a/component/options/51cto.tsx b/component/options/51cto.tsx
index bfc877a..dd2a6cb 100644
--- a/component/options/51cto.tsx
+++ b/component/options/51cto.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, EditOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -15,18 +14,6 @@ export default function Cto51() {
(v) => (v === undefined ? true : v)
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "51cto-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "51cto-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/baidu.tsx b/component/options/baidu.tsx
index f1a41d0..f758e21 100644
--- a/component/options/baidu.tsx
+++ b/component/options/baidu.tsx
@@ -1,8 +1,8 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -11,18 +11,6 @@ export default function Baidu() {
v === undefined ? false : v
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "baidu-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "baidu-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/cnblogs.tsx b/component/options/cnblogs.tsx
index 01e37dd..8fee02f 100644
--- a/component/options/cnblogs.tsx
+++ b/component/options/cnblogs.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -11,18 +10,6 @@ export default function Cnblogs() {
v === undefined ? true : v
)
- function downloadHtml() {
- sendToContentScript({
- name: "cnblogs-downloadHtml"
- })
- }
-
- function downloadMarkdown() {
- sendToContentScript({
- name: "cnblogs-downloadMarkdown"
- })
- }
-
return (
)
}
diff --git a/component/options/csdn.tsx b/component/options/csdn.tsx
index 27c6630..83d4356 100644
--- a/component/options/csdn.tsx
+++ b/component/options/csdn.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -33,18 +32,6 @@ export default function Csdn() {
(v) => (v === undefined ? true : v)
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "csdn-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "csdn-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/jb51.tsx b/component/options/jb51.tsx
index e513b2b..7d389e2 100644
--- a/component/options/jb51.tsx
+++ b/component/options/jb51.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -14,18 +13,6 @@ export default function Jb51() {
v === undefined ? true : v
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "jb51-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "jb51-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/jianshu.tsx b/component/options/jianshu.tsx
index 23aa6ea..1645db1 100644
--- a/component/options/jianshu.tsx
+++ b/component/options/jianshu.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -19,18 +18,6 @@ export default function Jianshu() {
(v) => (v === undefined ? true : v)
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "jianshu-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "jianshu-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/juejin.tsx b/component/options/juejin.tsx
index 93a69ee..79e1ddb 100644
--- a/component/options/juejin.tsx
+++ b/component/options/juejin.tsx
@@ -1,47 +1,15 @@
-import { DownloadOutlined, EditOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
-
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
export default function Juejin() {
- function editMarkdown() {
- sendToContentScript({
- name: "juejin-editMarkdown"
- })
- }
-
- function downloadMarkdown() {
- sendToContentScript({
- name: "juejin-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "juejin-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/oschina.tsx b/component/options/oschina.tsx
index 26c5bc6..e882b51 100644
--- a/component/options/oschina.tsx
+++ b/component/options/oschina.tsx
@@ -1,41 +1,15 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
-
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
export default function Oschina() {
- function downloadMarkdown() {
- sendToContentScript({
- name: "oschina-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "oschina-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/php.tsx b/component/options/php.tsx
index 737b964..940b5fd 100644
--- a/component/options/php.tsx
+++ b/component/options/php.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -15,18 +14,6 @@ export default function Php() {
(v) => (v === undefined ? true : v)
)
- function downloadHtml() {
- sendToContentScript({
- name: "php-downloadHtml"
- })
- }
-
- function downloadMarkdown() {
- sendToContentScript({
- name: "php-downloadMarkdown"
- })
- }
-
return (
)
}
diff --git a/component/options/segmentfault.tsx b/component/options/segmentfault.tsx
index e6d30f3..2fd7196 100644
--- a/component/options/segmentfault.tsx
+++ b/component/options/segmentfault.tsx
@@ -2,6 +2,8 @@ import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
import { sendToContentScript } from "@plasmohq/messaging"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -22,20 +24,8 @@ export default function Segmentfault() {
)
}
diff --git a/component/options/sortableItem.tsx b/component/options/sortableItem.tsx
index d9c2215..bc4939a 100644
--- a/component/options/sortableItem.tsx
+++ b/component/options/sortableItem.tsx
@@ -1,5 +1,3 @@
-import { useSortable } from "@dnd-kit/sortable"
-import { CSS } from "@dnd-kit/utilities"
import React from "react"
import Cto51 from "~component/options/51cto"
diff --git a/component/options/weixin.tsx b/component/options/weixin.tsx
index d43fa75..b24db55 100644
--- a/component/options/weixin.tsx
+++ b/component/options/weixin.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/dist/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -11,18 +10,6 @@ export default function Weixin() {
v === undefined ? true : v
)
- function downloadMarkdown() {
- sendToContentScript({
- name: "weixin-downloadMarkdown"
- })
- }
-
- function downloadHtml() {
- sendToContentScript({
- name: "weixin-downloadHtml"
- })
- }
-
return (
)
}
diff --git a/component/options/zhihu.tsx b/component/options/zhihu.tsx
index c25618f..32f0fc1 100644
--- a/component/options/zhihu.tsx
+++ b/component/options/zhihu.tsx
@@ -1,8 +1,7 @@
-import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"
-
-import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
+import DownloadHtml from "~component/items/downloadHtml"
+import DownloadMarkdown from "~component/items/downloadMarkdown"
import EditMarkdown from "~component/items/editMarkdown"
import { i18n } from "~tools"
@@ -19,18 +18,6 @@ export default function Zhihu() {
(v) => (v === undefined ? true : v)
)
- function downloadHtml() {
- sendToContentScript({
- name: "zhihu-downloadHtml"
- })
- }
-
- function downloadMarkdown() {
- sendToContentScript({
- name: "zhihu-downloadMarkdown"
- })
- }
-
return (
)
}
diff --git a/package.json b/package.json
index bf950a8..da4e164 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "code-box",
"displayName": "__MSG_extensionName__",
- "version": "0.8.0",
+ "version": "0.8.1",
"description": "__MSG_extensionDescription__",
"author": "027xiguapi. <458813868@qq.com>",
"scripts": {