diff --git a/component/51cto.tsx b/component/options/51cto.tsx similarity index 84% rename from component/51cto.tsx rename to component/options/51cto.tsx index 603eed8..812c55c 100644 --- a/component/51cto.tsx +++ b/component/options/51cto.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -56,11 +56,17 @@ export default function Cto51() { className="codebox-switch">
- {i18n("downloadMarkdown")}{" "} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/baidu.tsx b/component/options/baidu.tsx similarity index 78% rename from component/baidu.tsx rename to component/options/baidu.tsx index 0770eb0..ccc8acd 100644 --- a/component/baidu.tsx +++ b/component/options/baidu.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -38,11 +38,17 @@ export default function Baidu() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/cnblogs.tsx b/component/options/cnblogs.tsx similarity index 78% rename from component/cnblogs.tsx rename to component/options/cnblogs.tsx index b5be14f..a924098 100644 --- a/component/cnblogs.tsx +++ b/component/options/cnblogs.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -38,11 +38,17 @@ export default function Cnblogs() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/config.tsx b/component/options/config.tsx similarity index 100% rename from component/config.tsx rename to component/options/config.tsx diff --git a/component/content.tsx b/component/options/content.tsx similarity index 79% rename from component/content.tsx rename to component/options/content.tsx index 091c00a..edf0057 100644 --- a/component/content.tsx +++ b/component/options/content.tsx @@ -2,20 +2,20 @@ import React, { useEffect, useState } from "react" import { sendToContentScript } from "@plasmohq/messaging" -import Cto51 from "~component/51cto" -import Baidu from "~component/baidu" -import Cnblogs from "~component/cnblogs" -import Config from "~component/config" -import Csdn from "~component/csdn" -import Custom from "~component/custom" -import Jb51 from "~component/jb51" -import Jianshu from "~component/jianshu" -import Juejin from "~component/juejin" -import Oschina from "~component/oschina" -import Php from "~component/php" -import Segmentfault from "~component/segmentfault" -import Weixin from "~component/weixin" -import Zhihu from "~component/zhihu" +import Cto51 from "~component/options/51cto" +import Baidu from "~component/options/baidu" +import Cnblogs from "~component/options/cnblogs" +import Config from "~component/options/config" +import Csdn from "~component/options/csdn" +import Custom from "~component/options/custom" +import Jb51 from "~component/options/jb51" +import Jianshu from "~component/options/jianshu" +import Juejin from "~component/options/juejin" +import Oschina from "~component/options/oschina" +import Php from "~component/options/php" +import Segmentfault from "~component/options/segmentfault" +import Weixin from "~component/options/weixin" +import Zhihu from "~component/options/zhihu" export default function Content() { const [csdnIsShow, setCsdnIsShow] = useState(false) diff --git a/component/csdn.tsx b/component/options/csdn.tsx similarity index 92% rename from component/csdn.tsx rename to component/options/csdn.tsx index 4753859..ca76da7 100644 --- a/component/csdn.tsx +++ b/component/options/csdn.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined, HeartTwoTone } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -136,11 +136,17 @@ export default function Csdn() { className="codebox-switch">
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/custom.tsx b/component/options/custom.tsx similarity index 95% rename from component/custom.tsx rename to component/options/custom.tsx index c0e1701..f2a4915 100644 --- a/component/custom.tsx +++ b/component/options/custom.tsx @@ -15,7 +15,9 @@ export default function Custom() { const [codes, setCodes] = useState([]) useEffect(() => { - getCodes() + if (window.location.protocol != "chrome-extension:") { + getCodes() + } }, []) async function getCodes() { diff --git a/component/jb51.tsx b/component/options/jb51.tsx similarity index 83% rename from component/jb51.tsx rename to component/options/jb51.tsx index cb22dc1..bac29a6 100644 --- a/component/jb51.tsx +++ b/component/options/jb51.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -53,11 +53,17 @@ export default function Jb51() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/jianshu.tsx b/component/options/jianshu.tsx similarity index 87% rename from component/jianshu.tsx rename to component/options/jianshu.tsx index 9e16542..e242dbf 100644 --- a/component/jianshu.tsx +++ b/component/options/jianshu.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -74,11 +74,17 @@ export default function Jianshu() { htmlFor="jianshu-autoOpenCode">
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/juejin.tsx b/component/options/juejin.tsx similarity index 67% rename from component/juejin.tsx rename to component/options/juejin.tsx index 91a371f..35a4399 100644 --- a/component/juejin.tsx +++ b/component/options/juejin.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" @@ -21,11 +21,17 @@ export default function Juejin() {
{i18n("juejinConfig")}
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/oschina.tsx b/component/options/oschina.tsx similarity index 67% rename from component/oschina.tsx rename to component/options/oschina.tsx index 793d6b2..2b39797 100644 --- a/component/oschina.tsx +++ b/component/options/oschina.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" @@ -21,11 +21,17 @@ export default function Oschina() {
{i18n("oschinaConfig")}
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/php.tsx b/component/options/php.tsx similarity index 83% rename from component/php.tsx rename to component/options/php.tsx index c9f42c6..c021e8a 100644 --- a/component/php.tsx +++ b/component/options/php.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -54,11 +54,17 @@ export default function Php() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/segmentfault.tsx b/component/options/segmentfault.tsx similarity index 67% rename from component/segmentfault.tsx rename to component/options/segmentfault.tsx index b5701c9..c31948a 100644 --- a/component/segmentfault.tsx +++ b/component/options/segmentfault.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" @@ -21,11 +21,17 @@ export default function Segmentfault() {
{i18n("segmentfaultConfig")}
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/options/sortableItem.tsx b/component/options/sortableItem.tsx new file mode 100644 index 0000000..d9c2215 --- /dev/null +++ b/component/options/sortableItem.tsx @@ -0,0 +1,41 @@ +import { useSortable } from "@dnd-kit/sortable" +import { CSS } from "@dnd-kit/utilities" +import React from "react" + +import Cto51 from "~component/options/51cto" +import Baidu from "~component/options/baidu" +import Cnblogs from "~component/options/cnblogs" +import Config from "~component/options/config" +import Csdn from "~component/options/csdn" +import Custom from "~component/options/custom" +import Jb51 from "~component/options/jb51" +import Jianshu from "~component/options/jianshu" +import Juejin from "~component/options/juejin" +import Oschina from "~component/options/oschina" +import Php from "~component/options/php" +import Segmentfault from "~component/options/segmentfault" +import Weixin from "~component/options/weixin" +import Zhihu from "~component/options/zhihu" + +const itemMap = { + csdn: , + zhihu: , + baidu: , + juejin: , + oschina: , + jianshu: , + jb51: , + cnblogs: , + "51cto": , + php: , + segmentfault: , + weixin: , + custom: , + app: +} + +export default function SortableItem(props) { + const { item } = props + + return
{itemMap[item.value]}
+} diff --git a/component/weixin.tsx b/component/options/weixin.tsx similarity index 78% rename from component/weixin.tsx rename to component/options/weixin.tsx index 1ba739f..fa453a5 100644 --- a/component/weixin.tsx +++ b/component/options/weixin.tsx @@ -1,4 +1,4 @@ -import { DownloadOutlined } from "@ant-design/icons" +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/dist/hook" @@ -38,11 +38,17 @@ export default function Weixin() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} +
diff --git a/component/zhihu.tsx b/component/options/zhihu.tsx similarity index 81% rename from component/zhihu.tsx rename to component/options/zhihu.tsx index 78f5f1e..2da243a 100644 --- a/component/zhihu.tsx +++ b/component/options/zhihu.tsx @@ -1,3 +1,5 @@ +import { DownloadOutlined, StarTwoTone } from "@ant-design/icons" + import { sendToContentScript } from "@plasmohq/messaging" import { useStorage } from "@plasmohq/storage/hook" @@ -70,10 +72,18 @@ export default function Zhihu() {
- {i18n("downloadMarkdown")} + + + {i18n("downloadMarkdown")} + +
- {i18n("downloadHtml")} + + + {i18n("downloadHtml")} + +
) diff --git a/component/sortableItem.tsx b/component/sortableItem.tsx deleted file mode 100644 index 9d19571..0000000 --- a/component/sortableItem.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { useSortable } from "@dnd-kit/sortable" -import { CSS } from "@dnd-kit/utilities" -import React from "react" - -import Cto51 from "~component/51cto" -import Baidu from "~component/baidu" -import Cnblogs from "~component/cnblogs" -import Config from "~component/config" -import Csdn from "~component/csdn" -import Custom from "~component/custom" -import Jb51 from "~component/jb51" -import Jianshu from "~component/jianshu" -import Juejin from "~component/juejin" -import Oschina from "~component/oschina" -import Php from "~component/php" -import Segmentfault from "~component/segmentfault" -import Weixin from "~component/weixin" -import Zhihu from "~component/zhihu" - -const itemMap = { - csdn: , - zhihu: , - baidu: , - juejin: , - oschina: , - jianshu: , - jb51: , - cnblogs: , - "51cto": , - php: , - segmentfault: , - weixin: , - custom: , - app: -} - -export default function SortableItem(props) { - const { item } = props - - return
{itemMap[item.value]}
-} diff --git a/options/index.tsx b/options/index.tsx index 26c197c..eb61fd1 100644 --- a/options/index.tsx +++ b/options/index.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react" -import SortableItem from "~component/sortableItem" +import SortableItem from "~component/options/sortableItem" import { ThemeProvider } from "~theme" import { i18n } from "~tools" diff --git a/package.json b/package.json index 55aba0c..4a984a7 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,14 @@ { "name": "code-box", "displayName": "__MSG_extensionName__", - "version": "0.6.2", + "version": "0.6.3", "description": "__MSG_extensionDescription__", "author": "027xiguapi. <458813868@qq.com>", "scripts": { "dev": "plasmo dev", - "build": "plasmo build", - "build:firefox": "plasmo build --target=firefox-mv2", - "build:all": "rimraf build && plasmo build && plasmo build --target=firefox-mv2", + "build": "plasmo build --zip", + "build:firefox": "plasmo build --no-minify --no-hoist --zip --target=firefox-mv3", "package": "plasmo package", - "package:firefox": "plasmo package --target=firefox-mv2", - "package:all": "npm run build:all && plasmo package && plasmo package --target=firefox-mv2", "clean": "rimraf build" }, "repository": { diff --git a/popup/index.tsx b/popup/index.tsx index d139fd3..3f73586 100644 --- a/popup/index.tsx +++ b/popup/index.tsx @@ -1,4 +1,4 @@ -import Content from "~component/content" +import Content from "~component/options/content" import { ThemeProvider } from "~theme" import { i18n } from "~tools" diff --git a/public/app.txt b/public/app.txt index dcdd796..783563b 100644 --- a/public/app.txt +++ b/public/app.txt @@ -52,7 +52,6 @@ php中文网 1. First run `pnpm install` 2. Next run `pnpm build:firefox`, -3. Then run the `pnpm package:firefox`, -4. The running results are in the `build` folder +3. The running results are in the `build` folder diff --git a/public/en-config.jpg b/public/en-config.jpg new file mode 100644 index 0000000..c35cc9d Binary files /dev/null and b/public/en-config.jpg differ