import content from './example'
import { codemirror } from 'vue-codemirror'
import 'codemirror/lib/codemirror.css'
function aaa {
let a= 1;
}
const Component = {
name: 'markdown-panel',
components: {
codemirror
},
watch: {
content (v) {
this.$store.commit('markdownContent', v)
}
},
data () {
return {
content,
code: '# aaa',
cmOptions: {
tabSize: 4,
mode: 'text/javascript',
theme: 'base16-dark',
lineNumbers: true,
line: true,
}
}
},
methods: {
onCmReady(cm) {
console.log('the editor is readied!', cm)
},
onCmFocus(cm) {
console.log('the editor is focus!', cm)
},
onCmCodeChange(newCode) {
console.log('this is new code', newCode)
this.code = newCode
}
},
computed: {
codemirror() {
return this.$refs.myCm.codemirror
}
},
mounted() {
console.log('this is current codemirror object', this.codemirror)
},
created () {
this.$store.commit('markdownContent', content)
}
};
export default Component