Skip to content

Commit

Permalink
fix[markdown]: preview on the right is only 50px.
Browse files Browse the repository at this point in the history
  • Loading branch information
likwotsing committed Jun 30, 2020
1 parent 7c06214 commit 3057489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test:ci": "npm run lint && npm run test:unit"
},
"dependencies": {
"@toast-ui/editor": "^2.2.0",
"axios": "0.18.1",
"clipboard": "2.0.4",
"codemirror": "5.45.0",
Expand All @@ -34,7 +35,6 @@
"screenfull": "4.2.0",
"script-loader": "0.7.2",
"sortablejs": "1.8.4",
"tui-editor": "1.3.3",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"vue-router": "3.0.2",
Expand Down
19 changes: 9 additions & 10 deletions src/components/MarkdownEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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() {
Expand All @@ -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)
Expand Down

0 comments on commit 3057489

Please sign in to comment.