diff --git a/public/index.html b/public/index.html
index eb45cc9..f060e3c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,3 +1,14 @@
+
@@ -29,6 +40,7 @@
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/wechatsync/article-syncjs@latest/dist/styles.css"
/>
+
diff --git a/src/assets/example/markdown.md b/src/assets/example/markdown.md
index 524881b..59e12f6 100644
--- a/src/assets/example/markdown.md
+++ b/src/assets/example/markdown.md
@@ -1 +1,23 @@
-# sdfdsf
\ No newline at end of file
+# 示例文章:xxx
+
+
+## 一、标题
+
+### 1.1 一级标题
+
+
+## 二、段落
+
+
+
+
+## 三、字体
+
+
+
+
+## 四、欢迎访问
+
+
+
+
diff --git a/src/components/CodemirrorEditor/EditorHeader/index.vue b/src/components/CodemirrorEditor/EditorHeader/index.vue
index 58b31d5..dcafde8 100644
--- a/src/components/CodemirrorEditor/EditorHeader/index.vue
+++ b/src/components/CodemirrorEditor/EditorHeader/index.vue
@@ -137,7 +137,7 @@
-
+
+
- 复制
+ 复制到公众号
-
+
+
+ 复制到其它
+
+
+
+ {{ item.title }}
+
+
+
{
+ window.open(`https://mp.weixin.qq.com`, `_blank`)
+ }, 2000)
}, 350)
},
+ copyMd(url) {
+ // 输出提示
+ this.$notify({
+ showClose: true,
+ message: `已复制渲染后的文章到剪贴板,2秒后将跳转至对应网站`,
+ offset: 80,
+ duration: 1600,
+ type: `success`,
+ })
+ setTimeout(() => {
+ url && window.open(url, `_blank`)
+ }, 2000)
+ },
// 自定义CSS样式
async customStyle() {
this.$emit(`showCssEditor`)
@@ -410,6 +461,16 @@ export default {
this.showResetConfirm = false
this.editor.focus()
},
+ handleClick(e) {
+ let url = this.commands.filter((item) => item.key === e)[0].url
+ switch (e) {
+ case `wechat`:
+ this.copy(url)
+ break
+ default:
+ this.copyMd(url)
+ }
+ },
...mapActions(useStore, [
`setCurrentColor`,
`setCiteStatus`,
@@ -420,6 +481,7 @@ export default {
`setCurrentCodeTheme`,
`setWxRendererOptions`,
`setIsMacCodeBlock`,
+ `getDoc`,
]),
},
mounted() {
@@ -432,7 +494,9 @@ export default {
const fileInput = this.$refs.fileInput
fileInput.onchange = () => {
+ debugger
const file = fileInput.files[0]
+ debugger
if (file == null) {
return
}
@@ -442,6 +506,20 @@ export default {
this.$emit(`import-md`, read.result)
}
}
+
+ var clipboard = new ClipboardJS(`#copyButton`, {
+ text: () => {
+ return this.editor.getValue()
+ },
+ })
+
+ clipboard.on(`success`, (e) => {
+ console.log(`复制成功`)
+ })
+
+ clipboard.on(`error`, (e) => {
+ console.log(`复制失败`)
+ })
},
}