diff --git a/README.md b/README.md
index 994b24f..bae8be5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-## codebox-一键复制代码/下载文章
+# codebox-一键复制代码/下载文章
+
+[中文](README.md) | [English](README_EN.md)
## 代码
diff --git a/README_EN.md b/README_EN.md
new file mode 100644
index 0000000..bc3fed6
--- /dev/null
+++ b/README_EN.md
@@ -0,0 +1,181 @@
+# Codebox - One-click Code Copying/Downloading Articles
+
+[中文](README.md) | [English](README_EN.md)
+## Code
+
+https://github.com/027xiguapi/code-box
+
+## Introduction
+
+This browser plugin can be used on websites like CSDN/Zhihu/Script Home/Blog Garden/51CTO Blog/PHP Chinese Network/Juejin/WeChat, etc., to download articles as HTML or Markdown files with one click; to copy code without logging in; to support selected code; or to copy code with one click from the button in the upper right corner of the code; to remove the prompt to follow the blogger to read the full text; to remove the login pop-up window; to remove the pop-up window to jump to the APP.
+
+## Installation
+
+### Installation Method 1: Plugin Store (Recommended)
+
+Directly download and install:
+1. Enter the app store
+ - [Chrome Web Store](https://chrome.google.com/webstore/category/extensions?hl=zh-CN)
+ - [Edge Web Store](https://microsoftedge.microsoft.com/addons/Microsoft-Edge-Extensions-Home?hl=zh-CN)
+ - [360 Browser App Store](https://ext.se.360.cn/#/extension-detail?id=acnnhjllgegbndgknlliobjlekgilbdf)
+ - [Firefox Web Store](https://addons.mozilla.org/zh-CN/firefox/)
+
+2. Search: `codebox`
+
+
+
+
+
+### Installation Method 2: Direct Installation
+
+1. Installation address:
+ - [Go to Chrome Extension Store](https://chrome.google.com/webstore/detail/acnnhjllgegbndgknlliobjlekgilbdf)
+ - [Go to 360 Browser Extension Store](https://ext.se.360.cn/#/extension-detail?id=acnnhjllgegbndgknlliobjlekgilbdf)
+ - [Go to Firefox Extension Store](https://addons.mozilla.org/zh-CN/firefox/addon/code-box/)
+ - [Go to Edge Extension Store](https://microsoftedge.microsoft.com/addons/detail/code-box/cfpdbfmncaampihkmejogihjkenkonbn)
+
+### Installation Method 3: Download from WeChat Official Account
+
+1. Follow the WeChat official account
+
+
+
+2. Click `Software Download`
+
+
+
+### Installation Method 4: Source Code Installation
+
+1. Clone the source code
+ ```sh
+ git clone https://github.com/027xiguapi/code-box.git
+ ```
+2. Install and package
+ ```sh
+ pnpm install
+ pnpm dev
+ pnpm build
+ ```
+3. For Google Chrome, you can enter the plugin management page from the upper right menu -> More tools -> Extensions, or you can directly enter chrome://extensions in the address bar to access it.
+4. Check the developer mode, and you can directly load the plugin in the form of a folder.
+
+## Function
+
+
+
+### Customization
+
+- Insert custom styles (CSS code)
+- Download all images
+- Customize the selection to download HTML
+- Customize the selection to download Markdown
+- Customize the selection to download PDF
+
+### WeChat
+
+- Insert custom styles (CSS code)
+- One-click download of article HTML
+- One-click download of article Markdown
+- One-click download of article PDF
+- One-click download of all images
+
+### Nuggets
+
+- Insert custom styles (CSS code)
+- One-click download of article HTML
+- One-click download of article Markdown
+- One-click download of article PDF
+
+### CSDN
+
+- One-click download of article HTML, PDF, or Markdown files
+- Open any `CSDN` blog to start copying code
+- Support for selected code when not logged in to `CSDN`
+- One-click copy of code from the button in the upper right corner of the code when not logged in to `CSDN`
+- No more forced login pop-ups when not logged in to `CSDN`
+- No more prompts to follow the blogger to read the full text when not following the blogger, and the full text is displayed
+- Automatically expand code blocks
+- Block APP redirection on mobile
+- For non-VIP users, no more prompts for VIP viewing, and the full text is displayed
+- Insert custom styles (CSS code)
+
+### Zhihu
+
+- One-click download of article HTML, PDF, or Markdown files
+- One-click copy of code
+- No more prompts to expand and read the full text when not logged in to `Zhihu`, and the full text is displayed
+- No more forced login pop-ups when not logged in to `Zhihu`
+- Insert custom styles (CSS code)
+
+### Baidu
+
+- One-click download of dialog box HTML, PDF, or Markdown files
+- Close AI dialog box
+
+### Jian Shu
+
+- One-click download of article HTML, PDF, or Markdown files
+- One-click copy of code on mobile
+- No more prompts to expand and read the full text, and the full text is displayed
+- No more forced login pop-ups
+- Insert custom styles (CSS code)
+
+### Script Home
+
+- One-click download of article HTML, PDF, or Markdown files
+- Open any `Script Home` blog to start copying code
+- Support for selected code when not logged in to `Script Home`
+- Block ads
+- One-click copy of code from the button in the upper right corner of the code on mobile when not logged in to `Script Home`
+- Insert custom styles (CSS code)
+
+### Blog Garden
+
+- One-click download of article HTML, PDF, or Markdown files
+- One-click copy of code
+- Insert custom styles (CSS code)
+
+### 51CTO Blog
+
+- One-click download of article HTML, PDF, or Markdown files
+- Support for selected code when not logged in to `51CTO Blog`
+- One-click copy of code from the button in the upper right corner of the code when not logged in to `51CTO Blog`
+- No more forced login pop-ups when not logged in to `51CTO Blog`
+- One-click copy of code from the button in the upper right corner of the code on mobile when not logged in to `51CTO Blog`
+- Insert custom styles (CSS code)
+
+### PHP Chinese Network
+
+- One-click download of article HTML, PDF, or Markdown files
+- Support for selected code when not logged in to `PHP Chinese Network`
+- One-click copy of code from the button in the upper right corner of the code when not logged in to `PHP Chinese Network`
+- No more forced login pop-ups when not logged in to `PHP Chinese Network`
+- One-click copy of code from the button in the upper right corner of the code on mobile when not logged in to `PHP Chinese Network`
+- Insert custom styles (CSS code)
+
+
+
+
+
+
+
+
+
+
+
+## Reference
+
+1. [copy-csdn](https://github.com/openHacking/copy-csdn)
+2. [plasmo](https://github.com/PlasmoHQ/plasmo)
+3. [Chrome App Store One-stop Support](https://support.google.com/chrome_webstore/contact/one_stop_support)
+4. [Out-of-the-box web printing and downloading](https://juejin.cn/post/7412672713376497727)
+5. [Export WeChat Official Account Articles to PDF](https://greasyfork.org/en/scripts/510683-%E5%AF%BC%E5%87%BA%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7%E6%96%87%E7%AB%A0%E4%B8%BApdf/code)
+6. [One-click Download of WeChat Official Account Article Images](https://greasyfork.org/zh-CN/scripts/40583-%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7%E6%8E%A8%E6%96%87%E5%9B%BE%E7%89%87%E4%B8%80%E9%94%AE%E4%B8%8B%E8%BD%BD/code)
+
+## Privacy Policy
+
+[Webpage](https://027xiguapi.github.io/code-box/privacy-policy.html)
+
+## Support
+
+
\ No newline at end of file
diff --git a/component/ui/tags.tsx b/component/ui/tags.tsx
index f1320ec..24b54bb 100644
--- a/component/ui/tags.tsx
+++ b/component/ui/tags.tsx
@@ -11,7 +11,7 @@ const tagsStyles = {
alignItems: "center",
color: "#1e80ff",
width: "160px",
- background: "#fff",
+ backgroundColor: "rgb(255, 255, 255, .3)",
borderRadius: "5px",
justifyContent: "space-between",
padding: "0 8px",
@@ -21,6 +21,7 @@ const tagsStyles = {
}
export default function Tags(props: any) {
+ const [isShowTag, setIsShowTag] = useState(true)
const handleEdit = () => {
props.onEdit()
}
@@ -38,10 +39,10 @@ export default function Tags(props: any) {
}
const handleClose = () => {
- props.setIsShowTag(false)
+ setIsShowTag(false)
}
- return (
+ return isShowTag ? (
{i18n("edit")}
@@ -59,5 +60,7 @@ export default function Tags(props: any) {
+ ) : (
+ <>>
)
}
diff --git a/contents/51cto.tsx b/contents/51cto.tsx
index 386c0dd..83a11ac 100644
--- a/contents/51cto.tsx
+++ b/contents/51cto.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { addCss, i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -36,6 +38,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("51cto-showTag", true)
const [cssCode, runCss] = useCssCodeHook("51cto")
const [copyCode] = useStorage("51cto-copyCode")
@@ -242,34 +245,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
setContent(dom)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("article .article-detail")
+ setParseContent(dom)
}
return showTag ? (
-
-
- {i18n("edit")}
-
-
- {i18n("download")}
-
-
- {i18n("print")}
-
-
+
) : (
<>>
)
diff --git a/contents/cnblogs.tsx b/contents/cnblogs.tsx
index 35512e1..854eb3c 100644
--- a/contents/cnblogs.tsx
+++ b/contents/cnblogs.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
-import { i18n, saveHtml, saveMarkdown } from "~tools"
+import Tags from "~component/ui/tags"
+import { saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -37,6 +39,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("cnblogs-showTag", true)
const [cssCode, runCss] = useCssCodeHook("cnblogs")
const [copyCode] = useStorage("cnblogs-copyCode")
@@ -166,28 +169,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("#post_detail")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/csdn.tsx b/contents/csdn.tsx
index a5d8c1f..1f348b4 100644
--- a/contents/csdn.tsx
+++ b/contents/csdn.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { addCss, i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -35,6 +37,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("csdn-showTag", true)
const [cssCode, runCss] = useCssCodeHook("csdn")
const [closeAds] = useStorage("csdn-closeAds")
@@ -291,28 +294,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector(".blog-content-box")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/jb51.tsx b/contents/jb51.tsx
index 050b0f1..dd0cb82 100644
--- a/contents/jb51.tsx
+++ b/contents/jb51.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { addCss, i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -36,6 +38,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("jb51-showTag", true)
const [cssCode, runCss] = useCssCodeHook("jb51")
const [closeAds] = useStorage("jb51-closeAds")
@@ -246,28 +249,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("#article")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/jianshu.tsx b/contents/jianshu.tsx
index 783f453..c6a5438 100644
--- a/contents/jianshu.tsx
+++ b/contents/jianshu.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { addCss, i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -36,6 +38,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("jianshu-showTag", true)
const [cssCode, runCss] = useCssCodeHook("jianshu")
const [closeLoginModal] = useStorage("jianshu-closeLoginModal")
@@ -196,28 +199,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("section.ouvJEz")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/juejin.tsx b/contents/juejin.tsx
index 7385ba2..df73160 100644
--- a/contents/juejin.tsx
+++ b/contents/juejin.tsx
@@ -11,9 +11,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/dist/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -64,6 +66,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("juejin-showTag", true)
const [cssCode, runCss] = useCssCodeHook("juejin")
const [content, setContent] = useEditMarkdown()
@@ -111,28 +114,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("article.article")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/medium.tsx b/contents/medium.tsx
index 0138d07..0b5e920 100644
--- a/contents/medium.tsx
+++ b/contents/medium.tsx
@@ -168,8 +168,6 @@ const PlasmoOverlay: FC = ({ anchor }) => {
onDownload={downloadMarkdown}
onPrint={downloadPdf}
onParse={parseMarkdown}
- isShowTag={showTag}
- setIsShowTag={setShowTag}
/>
) : (
<>>
diff --git a/contents/oschina.tsx b/contents/oschina.tsx
index 6b1b160..219c4c6 100644
--- a/contents/oschina.tsx
+++ b/contents/oschina.tsx
@@ -11,9 +11,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/dist/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -35,6 +37,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("oschina-showTag", true)
const [cssCode, runCss] = useCssCodeHook("oschina")
const [content, setContent] = useEditMarkdown()
@@ -82,28 +85,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector(".article-box")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/php.tsx b/contents/php.tsx
index d2f160f..76adc7d 100644
--- a/contents/php.tsx
+++ b/contents/php.tsx
@@ -11,9 +11,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { addCss, i18n, removeCss, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -35,6 +37,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("php-showTag", true)
const [cssCode, runCss] = useCssCodeHook("php")
const [copyCode] = useStorage("php-copyCode", true)
@@ -133,28 +136,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector(".phpscMain .php-article")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/segmentfault.tsx b/contents/segmentfault.tsx
index 46fe15a..74592a0 100644
--- a/contents/segmentfault.tsx
+++ b/contents/segmentfault.tsx
@@ -11,9 +11,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/dist/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -35,6 +37,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage(
"segmentfault-showTag",
true
@@ -85,28 +88,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector(".container")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/weixin.tsx b/contents/weixin.tsx
index e5d4026..9a4b9f3 100644
--- a/contents/weixin.tsx
+++ b/contents/weixin.tsx
@@ -13,9 +13,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/dist/hook"
import TagBtnStyle from "~component/tagBtn/style"
+import Tags from "~component/ui/tags"
import { i18n, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -37,6 +39,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("weixin-showTag", true)
const [cssCode, runCss] = useCssCodeHook("weixin")
const [history, setHistory] = useStorage("codebox-history")
@@ -146,28 +149,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("#img-content")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/contents/zhihu.tsx b/contents/zhihu.tsx
index b034e7c..0b1f219 100644
--- a/contents/zhihu.tsx
+++ b/contents/zhihu.tsx
@@ -12,9 +12,11 @@ import { useMessage } from "@plasmohq/messaging/hook"
import { useStorage } from "@plasmohq/storage/hook"
import TagBtnStyle from "~component/tagBtn/style"
-import { addCss, i18n, saveHtml, saveMarkdown } from "~tools"
+import Tags from "~component/ui/tags"
+import { addCss, saveHtml, saveMarkdown } from "~tools"
import useCssCodeHook from "~utils/cssCodeHook"
import { useEditMarkdown } from "~utils/editMarkdownHook"
+import { useParseMarkdown } from "~utils/parseMarkdownHook"
import { Print } from "~utils/print"
import Turndown from "~utils/turndown"
@@ -36,6 +38,7 @@ export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
export const getStyle: PlasmoGetStyle = () => TagBtnStyle()
const PlasmoOverlay: FC = ({ anchor }) => {
+ const [parseContent, setParseContent] = useParseMarkdown()
const [showTag, setShowTag] = useStorage("zhihu-showTag", true)
const [cssCode, runCss] = useCssCodeHook("zhihu")
const [closeLoginModal] = useStorage("zhihu-closeLoginModal")
@@ -216,28 +219,18 @@ const PlasmoOverlay: FC = ({ anchor }) => {
saveHtml(dom, articleTitle)
}
- function handleEdit() {
- editMarkdown()
- }
-
- function handleDownload() {
- downloadMarkdown()
- }
-
- function handlePrint() {
- downloadPdf()
- }
-
- function closeTag() {
- setShowTag(false)
+ function parseMarkdown() {
+ const dom = document.querySelector("article.Post-Main")
+ setParseContent(dom)
}
return showTag ? (
-
-
{i18n("edit")}
-
{i18n("download")}
-
{i18n("print")}
-
+
) : (
<>>
)
diff --git a/package.json b/package.json
index ff3f146..853cb7d 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "code-box",
"displayName": "__MSG_extensionName__",
- "version": "1.0.1",
+ "version": "1.0.2",
"description": "__MSG_extensionDescription__",
"author": "027xiguapi. <458813868@qq.com>",
"scripts": {
diff --git a/public/wx/u_wx.jpg b/public/wx/u_wx.jpg
new file mode 100644
index 0000000..638f17b
Binary files /dev/null and b/public/wx/u_wx.jpg differ