(option?)
| 4 | import Turndown from "~utils/turndown" |
| 5 | |
| 6 | export function useEditMarkdown(option?) { |
| 7 | const turndownService = Turndown(option) |
| 8 | |
| 9 | const [post, setPost] = useStorage({ |
| 10 | key: "md-post", |
| 11 | instance: new Storage({ |
| 12 | area: "local" |
| 13 | }) |
| 14 | }) |
| 15 | |
| 16 | const handleSetPost = (selectorDom, articleTitle) => { |
| 17 | const content = turndownService.turndown(selectorDom) |
| 18 | const post = { |
| 19 | content: content, |
| 20 | title: articleTitle |
| 21 | } |
| 22 | setPost(JSON.stringify(post)) |
| 23 | window.open("https://md.code-box.fun", "_blank") |
| 24 | } |
| 25 | |
| 26 | return [post, handleSetPost] |
| 27 | } |
no test coverage detected