mirror of
https://github.com/doocs/md.git
synced 2024-11-28 13:36:32 +08:00
feat: add one-click download function
新增一键下载功能
This commit is contained in:
parent
997db36d5e
commit
feeab444df
@ -28,6 +28,7 @@ Markdown 文档自动即时渲染为微信图文,让你不再为微信文章
|
|||||||
- [x] 支持链接微信图文,外链自动转为文末索引
|
- [x] 支持链接微信图文,外链自动转为文末索引
|
||||||
- [x] 支持一键复制并粘贴到公众号后台
|
- [x] 支持一键复制并粘贴到公众号后台
|
||||||
- [x] 支持多图上传并将 URL 插入编辑器光标定位处
|
- [x] 支持多图上传并将 URL 插入编辑器光标定位处
|
||||||
|
- [x] 支持一键下载 Markdown 文档到本地
|
||||||
- [x] 支持自定义 CSS 样式并实时渲染
|
- [x] 支持自定义 CSS 样式并实时渲染
|
||||||
- [x] 支持一键恢复至默认内容及样式
|
- [x] 支持一键恢复至默认内容及样式
|
||||||
- [x] 支持打开或关闭引用链接的选项
|
- [x] 支持打开或关闭引用链接的选项
|
||||||
|
@ -202,6 +202,19 @@ let app = new Vue({
|
|||||||
localStorage.removeItem(name);
|
localStorage.removeItem(name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 下载编辑器内容到本地
|
||||||
|
downloadEditorContent() {
|
||||||
|
let downLink = document.createElement('a');
|
||||||
|
downLink.download = 'content.md';
|
||||||
|
downLink.style.display = 'none';
|
||||||
|
let blob = new Blob([this.editor.getValue(0)]);
|
||||||
|
downLink.href = URL.createObjectURL(blob);
|
||||||
|
console.log(downLink);
|
||||||
|
document.body.appendChild(downLink);
|
||||||
|
downLink.click();
|
||||||
|
document.body.removeChild(downLink);
|
||||||
|
},
|
||||||
|
// 自定义CSS样式
|
||||||
async customStyle() {
|
async customStyle() {
|
||||||
this.showBox = !this.showBox;
|
this.showBox = !this.showBox;
|
||||||
let flag = await localStorage.getItem("__css_content")
|
let flag = await localStorage.getItem("__css_content")
|
||||||
@ -209,6 +222,7 @@ let app = new Vue({
|
|||||||
this.cssEditor.setValue(DEFAULT_CSS_CONTENT);
|
this.cssEditor.setValue(DEFAULT_CSS_CONTENT);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 复制渲染后的内容到剪贴板
|
||||||
copy() {
|
copy() {
|
||||||
let clipboardDiv = document.getElementById('output');
|
let clipboardDiv = document.getElementById('output');
|
||||||
clipboardDiv.focus();
|
clipboardDiv.focus();
|
||||||
|
@ -50,6 +50,10 @@
|
|||||||
<i class="el-icon-upload" size="medium"> </i>
|
<i class="el-icon-upload" size="medium"> </i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<!-- 下载文本文档 -->
|
||||||
|
<el-tooltip class="item" effect="dark" content="点击下载编辑框Markdown文档" placement="bottom-start">
|
||||||
|
<i class="el-icon-download" size="medium" @click="downloadEditorContent"> </i>
|
||||||
|
</el-tooltip>
|
||||||
<!-- 页面重置 -->
|
<!-- 页面重置 -->
|
||||||
<el-tooltip class="item" effect="dark" content="点击重置页面" placement="bottom-start">
|
<el-tooltip class="item" effect="dark" content="点击重置页面" placement="bottom-start">
|
||||||
<i class="el-icon-refresh" size="medium" @click="reset"> </i>
|
<i class="el-icon-refresh" size="medium" @click="reset"> </i>
|
||||||
|
Loading…
Reference in New Issue
Block a user