50 lines
1.0 KiB
Vue
50 lines
1.0 KiB
Vue
<template>
|
|
<div>
|
|
<editor
|
|
ref="myEditor"
|
|
v-model="text"
|
|
@init="editorInit"
|
|
lang="asciidoc"
|
|
theme="tomorrow_night"
|
|
width="100%"
|
|
height="500" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "Editor",
|
|
data: function () {
|
|
return {
|
|
text: ''
|
|
}
|
|
},
|
|
props: {
|
|
content: String
|
|
},
|
|
components: {
|
|
editor: require('vue2-ace-editor')
|
|
},
|
|
watch: {
|
|
content: function(newValue) {
|
|
let editor = this.$refs.myEditor.editor
|
|
editor.renderer.updateFull()
|
|
this.text = newValue
|
|
},
|
|
text: function() {
|
|
this.$emit('change', this.text)
|
|
}
|
|
},
|
|
methods: {
|
|
editorInit: function () {
|
|
require('brace/ext/language_tools') //language extension prerequsite...
|
|
require('brace/mode/asciidoc') //language
|
|
require('brace/theme/tomorrow_night')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |