cabinet/frontend/src/components/Editor.vue

50 lines
1.0 KiB
Vue
Raw Normal View History

2019-11-01 17:09:17 +00:00
<template>
<div>
2019-11-16 13:49:07 +00:00
<editor
ref="myEditor"
v-model="text"
@init="editorInit"
lang="asciidoc"
theme="tomorrow_night"
width="100%"
height="500" />
2019-11-01 17:09:17 +00:00
</div>
</template>
<script>
export default {
name: "Editor",
data: function () {
return {
text: ''
}
},
props: {
content: String
},
components: {
editor: require('vue2-ace-editor')
},
watch: {
content: function(newValue) {
2019-11-08 01:54:00 +00:00
let editor = this.$refs.myEditor.editor
editor.renderer.updateFull()
2019-11-01 17:09:17 +00:00
this.text = newValue
2019-11-08 01:54:00 +00:00
},
text: function() {
this.$emit('change', this.text)
2019-11-01 17:09:17 +00:00
}
},
methods: {
editorInit: function () {
require('brace/ext/language_tools') //language extension prerequsite...
require('brace/mode/asciidoc') //language
2019-11-16 13:49:07 +00:00
require('brace/theme/tomorrow_night')
2019-11-01 17:09:17 +00:00
}
}
}
</script>
<style scoped>
</style>