Bugfix: can not empty the content in source code mode #105

This commit is contained in:
Jocs 2018-03-31 18:37:27 +08:00
parent fb057ee825
commit aab3c652c5
2 changed files with 3 additions and 1 deletions

View File

@ -424,7 +424,6 @@ class Aganippe {
setMarkdown (markdown, cursor, renderCursor = true) {
// if markdown is blank, dont need to import markdown
if (!markdown.trim()) return
let newMarkdown = markdown
if (cursor) {
newMarkdown = this.contentState.addCursorToMarkdown(markdown, cursor)

View File

@ -18,12 +18,14 @@
cursor: Object,
theme: String
},
data () {
return {
contentState: null,
editor: null
}
},
watch: {
theme: function (value, oldValue) {
const cm = this.$refs.sourceCode.querySelector('.CodeMirror')
@ -38,6 +40,7 @@
}
}
},
created () {
this.$nextTick(() => {
const { markdown = '', theme } = this