diff --git a/assets/default-content.md b/assets/default-content.md index 47496bc..f7e4e14 100644 --- a/assets/default-content.md +++ b/assets/default-content.md @@ -80,6 +80,13 @@ Google 拥有专门设计的系统,可以自动捕获不适当的预测结果 目前有不少开源库都提供了这个功能,比如主流的搜索引擎框架 [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开源社区”,原创技术文章第一时间推送。 ![](https://gitee.com/doocs/md/raw/master/assets/images/qrcode-for-doocs.jpg) \ No newline at end of file diff --git a/assets/scripts/editor.js b/assets/scripts/editor.js index f4b427b..6e7b532 100644 --- a/assets/scripts/editor.js +++ b/assets/scripts/editor.js @@ -81,12 +81,7 @@ let app = new Vue({ if (localStorage.getItem("__editor_content")) { this.editor.setValue(localStorage.getItem("__editor_content")); } else { - axios({ - method: 'get', - url: './assets/default-content.md' - }).then(resp => { - this.editor.setValue(resp.data); - }) + this.setDefaultContent(); } if (localStorage.getItem('__css_content')) { @@ -184,6 +179,23 @@ let app = new Vue({ refresh() { 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 saveEditorContent() { let content = this.editor.getValue(0); @@ -196,7 +208,16 @@ let app = new Vue({ customStyle() { this.saveEditorContent(this.cssEditor, '__css_content'); 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() { let clipboardDiv = document.getElementById('output'); diff --git a/assets/scripts/renderers/wx-renderer.js b/assets/scripts/renderers/wx-renderer.js index b2fa4d0..8a441ff 100644 --- a/assets/scripts/renderers/wx-renderer.js +++ b/assets/scripts/renderers/wx-renderer.js @@ -98,7 +98,6 @@ let WxRenderer = function (opts) { styleMapping = this.buildTheme(this.opts.theme); let renderer = new marked.Renderer(); - FuriganaMD.register(renderer); renderer.heading = (text, level) => { switch (level) { diff --git a/index.html b/index.html index 18bab43..c88a567 100644 --- a/index.html +++ b/index.html @@ -43,6 +43,10 @@   + + +   +