Merge branch 'master' into feat/custom-css

This commit is contained in:
yanglbme 2019-12-07 17:07:05 +08:00
commit 8d1ca62bd8
4 changed files with 39 additions and 8 deletions

View File

@ -80,6 +80,13 @@ Google 拥有专门设计的系统,可以自动捕获不适当的预测结果
目前有不少开源库都提供了这个功能,比如主流的搜索引擎框架 [Elasticsearch](https://www.elastic.co/products/elasticsearch)、[Solr](https://lucene.apache.org/solr/) 等,基于此,我们可以实现高效而强大的自动补全功能。 目前有不少开源库都提供了这个功能,比如主流的搜索引擎框架 [Elasticsearch](https://www.elastic.co/products/elasticsearch)、[Solr](https://lucene.apache.org/solr/) 等,基于此,我们可以实现高效而强大的自动补全功能。
#### 推荐阅读
- [阿里又一个 20k+ stars 开源项目诞生,恭喜 fastjson](https://mp.weixin.qq.com/s/RNKDCK2KoyeuMeEs6GUrow)
- [刷掉 90% 候选人的互联网大厂海量数据面试题(附题解 + 方法总结)](https://mp.weixin.qq.com/s/rjGqxUvrEqJNlo09GrT1Dw)
- [好用!期待已久的文本块功能究竟如何在 Java 13 中发挥作用?](https://mp.weixin.qq.com/s/kalGv5T8AZGxTnLHr2wDsA)
- [2019 GitHub 开源贡献排行榜新鲜出炉!微软谷歌领头,阿里跻身前 12](https://mp.weixin.qq.com/s/_q812aGD1b9QvZ2WFI0Qgw)
欢迎关注我的公众号“Doocs开源社区”原创技术文章第一时间推送。 欢迎关注我的公众号“Doocs开源社区”原创技术文章第一时间推送。
![](https://gitee.com/doocs/md/raw/master/assets/images/qrcode-for-doocs.jpg) ![](https://gitee.com/doocs/md/raw/master/assets/images/qrcode-for-doocs.jpg)

View File

@ -81,12 +81,7 @@ let app = new Vue({
if (localStorage.getItem("__editor_content")) { if (localStorage.getItem("__editor_content")) {
this.editor.setValue(localStorage.getItem("__editor_content")); this.editor.setValue(localStorage.getItem("__editor_content"));
} else { } else {
axios({ this.setDefaultContent();
method: 'get',
url: './assets/default-content.md'
}).then(resp => {
this.editor.setValue(resp.data);
})
} }
if (localStorage.getItem('__css_content')) { if (localStorage.getItem('__css_content')) {
@ -184,6 +179,23 @@ let app = new Vue({
refresh() { refresh() {
this.output = this.renderWeChat(this.editor.getValue(0)); this.output = this.renderWeChat(this.editor.getValue(0));
}, },
// 重置页面
reset() {
this.$confirm('此操作将丢失本地缓存的文本和自定义样式,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
localStorage.removeItem('__editor_content');
localStorage.removeItem('__css_content');
this.setDefaultContent();
this.editor.focus();
this.refresh();
}).catch(() => {
this.editor.focus();
});
},
// 将左侧编辑器内容保存到 LocalStorage // 将左侧编辑器内容保存到 LocalStorage
saveEditorContent() { saveEditorContent() {
let content = this.editor.getValue(0); let content = this.editor.getValue(0);
@ -196,7 +208,16 @@ let app = new Vue({
customStyle() { customStyle() {
this.saveEditorContent(this.cssEditor, '__css_content'); this.saveEditorContent(this.cssEditor, '__css_content');
this.showBox = !this.showBox; this.showBox = !this.showBox;
},
setDefaultContent() {
axios({
method: 'get',
url: './assets/default-content.md'
}).then(resp => {
this.editor.setValue(resp.data);
}).catch(err => {
this.editor.setValue('# Your markdown here\n');
})
}, },
copy() { copy() {
let clipboardDiv = document.getElementById('output'); let clipboardDiv = document.getElementById('output');

View File

@ -98,7 +98,6 @@ let WxRenderer = function (opts) {
styleMapping = this.buildTheme(this.opts.theme); styleMapping = this.buildTheme(this.opts.theme);
let renderer = new marked.Renderer(); let renderer = new marked.Renderer();
FuriganaMD.register(renderer);
renderer.heading = (text, level) => { renderer.heading = (text, level) => {
switch (level) { switch (level) {

View File

@ -43,6 +43,10 @@
<i class="el-icon-upload" size="medium">&nbsp;</i> <i class="el-icon-upload" size="medium">&nbsp;</i>
</el-tooltip> </el-tooltip>
</el-upload> </el-upload>
<!-- 页面重置 -->
<el-tooltip class="item" effect="dark" content="点击重置页面" placement="bottom-start">
<i class="el-icon-refresh" size="medium" @click="reset">&nbsp;</i>
</el-tooltip>
<el-form size="mini" class="ctrl" :inline=true> <el-form size="mini" class="ctrl" :inline=true>
<el-form-item label="编辑器主题"> <el-form-item label="编辑器主题">
<el-select v-model="currentEditorTheme" size="mini" placeholder="选择编辑器主题" clearable <el-select v-model="currentEditorTheme" size="mini" placeholder="选择编辑器主题" clearable