Merge 3057489cc6
into 33a93a12b4
This commit is contained in:
@@ -4,11 +4,10 @@
|
||||
|
||||
<script>
|
||||
// deps for editor
|
||||
import 'codemirror/lib/codemirror.css' // codemirror
|
||||
import 'tui-editor/dist/tui-editor.css' // editor ui
|
||||
import 'tui-editor/dist/tui-editor-contents.css' // editor content
|
||||
import 'codemirror/lib/codemirror.css' // Editor's Dependency Style
|
||||
import '@toast-ui/editor/dist/toastui-editor.css' // Editor's Style
|
||||
|
||||
import Editor from 'tui-editor'
|
||||
import Editor from '@toast-ui/editor'
|
||||
import defaultOptions from './default-options'
|
||||
|
||||
export default {
|
||||
@@ -62,8 +61,8 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
value(newValue, preValue) {
|
||||
if (newValue !== preValue && newValue !== this.editor.getValue()) {
|
||||
this.editor.setValue(newValue)
|
||||
if (newValue !== preValue && newValue !== this.editor.getMarkdown()) {
|
||||
this.editor.setMarkdown(newValue)
|
||||
}
|
||||
},
|
||||
language(val) {
|
||||
@@ -90,10 +89,10 @@ export default {
|
||||
...this.editorOptions
|
||||
})
|
||||
if (this.value) {
|
||||
this.editor.setValue(this.value)
|
||||
this.editor.setMarkdown(this.value)
|
||||
}
|
||||
this.editor.on('change', () => {
|
||||
this.$emit('input', this.editor.getValue())
|
||||
this.$emit('input', this.editor.getMarkdown())
|
||||
})
|
||||
},
|
||||
destroyEditor() {
|
||||
@@ -102,10 +101,10 @@ export default {
|
||||
this.editor.remove()
|
||||
},
|
||||
setValue(value) {
|
||||
this.editor.setValue(value)
|
||||
this.editor.setMarkdown(value)
|
||||
},
|
||||
getValue() {
|
||||
return this.editor.getValue()
|
||||
return this.editor.getMarkdown()
|
||||
},
|
||||
setHtml(value) {
|
||||
this.editor.setHtml(value)
|
||||
|
Reference in New Issue
Block a user