chore:1.修复主题无法更新的问题

2.修复文档初始化值无法动态切换的问题
This commit is contained in:
zhaoxuhui 2018-09-07 14:32:05 +08:00
parent d0428e6729
commit a036667426
5 changed files with 138 additions and 112 deletions

View File

@ -134,3 +134,10 @@ const config = {
}, },
``` ```
### 更新日志
v0.7.0
1.修复主题无法更新的问题
2.修复文档初始化值无法动态切换的问题

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{ {
"name": "vue-meditor", "name": "vue-meditor",
"description": "一款使用marked和highlight.js开发的一款markdown编辑器", "description": "一款使用marked和highlight.js开发的一款markdown编辑器",
"version": "0.1.1", "version": "0.7.0",
"author": "zhaoxuhui<1258835133@qq.com>", "author": "zhaoxuhui<1258835133@qq.com>",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -118,7 +118,10 @@ export default {
} }
}, },
tools() { tools() {
const {allTools, toolbars} = this; const {
allTools,
toolbars
} = this;
return Object.assign(allTools, toolbars) return Object.assign(allTools, toolbars)
} }
}, },
@ -132,7 +135,13 @@ export default {
methods: { methods: {
init() { init() {
this.themeName = this.theme; this.themeName = this.theme;
const {autoSave, interval, theme, initialValue, mode} = this; const {
autoSave,
interval,
theme,
initialValue,
mode
} = this;
this.value = initialValue; this.value = initialValue;
this.preview = mode; this.preview = mode;
this.previewMarkdown = marked(initialValue, { this.previewMarkdown = marked(initialValue, {
@ -169,7 +178,9 @@ export default {
this.scroll = side; this.scroll = side;
}, },
insertContent(str) { // 插入文本 insertContent(str) { // 插入文本
const {preview} = this; const {
preview
} = this;
if (preview === 2) { if (preview === 2) {
return; return;
} }
@ -365,7 +376,7 @@ export default {
this.$emit('on-save', { this.$emit('on-save', {
markdownValue: this.value, markdownValue: this.value,
htmlValue: this.previewMarkdown, htmlValue: this.previewMarkdown,
theme : this.theme theme: this.themeName
}); });
}, },
insertLine() { // 插入分割线 insertLine() { // 插入分割线
@ -379,7 +390,9 @@ export default {
this.slideDown = false; this.slideDown = false;
}, },
enter(e) { // 回车事件 enter(e) { // 回车事件
const {lastInsert} = this; const {
lastInsert
} = this;
const list = ['- ', '1. ', '- [ ] ', '- [x] '] const list = ['- ', '1. ', '- [ ] ', '- [x] ']
if (list.includes(lastInsert)) { if (list.includes(lastInsert)) {
this.insertContent(lastInsert); this.insertContent(lastInsert);
@ -424,6 +437,12 @@ export default {
const height_2 = this.$refs.textarea.scrollHeight; const height_2 = this.$refs.textarea.scrollHeight;
const height_3 = this.$refs.preview.scrollHeight; const height_3 = this.$refs.preview.scrollHeight;
this.scrollHeight = Math.max(height_1, height_2, height_3); this.scrollHeight = Math.max(height_1, height_2, height_3);
},
initialValue() {
this.value = this.initialValue;
},
theme() {
this.themeName = this.theme;
} }
}, },
destroyed() { // 销毁时清除定时器 destroyed() { // 销毁时清除定时器