优化下载markdown和html

This commit is contained in:
fzk
2024-10-11 09:12:01 +08:00
parent aef408f8eb
commit 943b73dfbd
16 changed files with 100 additions and 344 deletions
+25
View File
@@ -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 (
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
)
}
+25
View File
@@ -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 (
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
)
}
+5 -30
View File
@@ -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 (
<fieldset>
<legend>{i18n("51ctoConfig")}</legend>
@@ -56,21 +43,9 @@ export default function Cto51() {
htmlFor="51cto-closeLoginModal"
className="codebox-switch"></label>
</div>
<EditMarkdown></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<EditMarkdown name="51cto"></EditMarkdown>
<DownloadMarkdown name="51cto"></DownloadMarkdown>
<DownloadHtml name="51cto"></DownloadHtml>
</fieldset>
)
}
+4 -28
View File
@@ -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 (
<fieldset>
<legend>{i18n("baiduConfig")}</legend>
@@ -39,20 +27,8 @@ export default function Baidu() {
<label className="codebox-switch" htmlFor="baidu-closeAIBox"></label>
</div>
<EditMarkdown name="baidu"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="baidu"></DownloadMarkdown>
<DownloadHtml name="baidu"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("cnblogsConfig")}</legend>
@@ -39,20 +26,8 @@ export default function Cnblogs() {
<label className="codebox-switch" htmlFor="cnblogs-copyCode"></label>
</div>
<EditMarkdown name="cnblogs"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="cnblogs"></DownloadMarkdown>
<DownloadHtml name="cnblogs"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("csdnConfig")}</legend>
@@ -137,20 +124,8 @@ export default function Csdn() {
className="codebox-switch"></label>
</div>
<EditMarkdown name="csdn"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="csdn"></DownloadMarkdown>
<DownloadHtml name="csdn"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("jb51Config")}</legend>
@@ -54,20 +41,8 @@ export default function Jb51() {
<label className="codebox-switch" htmlFor="jb51-copyCode"></label>
</div>
<EditMarkdown name="jb51"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="jb51"></DownloadMarkdown>
<DownloadHtml name="jb51"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("jianshuConfig")}</legend>
@@ -75,20 +62,8 @@ export default function Jianshu() {
htmlFor="jianshu-autoOpenCode"></label>
</div>
<EditMarkdown name="jianshu"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="jianshu"></DownloadMarkdown>
<DownloadHtml name="jianshu"></DownloadHtml>
</fieldset>
)
}
+4 -36
View File
@@ -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 (
<fieldset>
<legend>{i18n("juejinConfig")}</legend>
<EditMarkdown name="juejin"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="juejin"></DownloadMarkdown>
<DownloadHtml name="juejin"></DownloadHtml>
</fieldset>
)
}
+4 -30
View File
@@ -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 (
<fieldset>
<legend>{i18n("oschinaConfig")}</legend>
<EditMarkdown name="oschina"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="oschina"></DownloadMarkdown>
<DownloadHtml name="oschina"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("phpConfig")}</legend>
@@ -55,20 +42,8 @@ export default function Php() {
<label htmlFor="php-closeLoginModal" className="codebox-switch"></label>
</div>
<EditMarkdown name="php"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="php"></DownloadMarkdown>
<DownloadHtml name="php"></DownloadHtml>
</fieldset>
)
}
+4 -14
View File
@@ -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() {
<fieldset>
<legend>{i18n("segmentfaultConfig")}</legend>
<EditMarkdown name="segmentfault"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="segmentfault"></DownloadMarkdown>
<DownloadHtml name="segmentfault"></DownloadHtml>
</fieldset>
)
}
-2
View File
@@ -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"
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("weixinConfig")}</legend>
@@ -39,20 +26,8 @@ export default function Weixin() {
<label className="codebox-switch" htmlFor="weixin-copyCode"></label>
</div>
<EditMarkdown name="weixin"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="weixin"></DownloadMarkdown>
<DownloadHtml name="weixin"></DownloadHtml>
</fieldset>
)
}
+4 -29
View File
@@ -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 (
<fieldset>
<legend>{i18n("zhihuConfig")}</legend>
@@ -73,20 +60,8 @@ export default function Zhihu() {
<label className="codebox-switch" htmlFor="zhihu-autoOpenCode"></label>
</div>
<EditMarkdown name="zhihu"></EditMarkdown>
<div className="item download" onClick={downloadMarkdown}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<DownloadMarkdown name="weixin"></DownloadMarkdown>
<DownloadHtml name="weixin"></DownloadHtml>
</fieldset>
)
}
+1 -1
View File
@@ -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": {