1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-04-05 11:18:42 +08:00

Merge cd9fb08c106adb7279135b7371fb14595f591058 into 6858a9ad67483025f6a9432a926beb9327037be3

This commit is contained in:
hykBigHeart 2024-11-28 00:30:15 +00:00 committed by GitHub
commit 83995eeaf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 13 deletions

View File

@ -5,6 +5,7 @@
"author": "Pan <panfree23@gmail.com>",
"scripts": {
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"lint": "eslint --ext .js,.vue src",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
@ -34,7 +35,7 @@
"screenfull": "4.2.0",
"script-loader": "0.7.2",
"sortablejs": "1.8.4",
"tui-editor": "1.3.3",
"@toast-ui/editor": "^3.1.3",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"vue-router": "3.0.2",

View File

@ -4,11 +4,16 @@
<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' // codemirror
// import 'tui-editor/dist/tui-editor.css' // editor ui
// import 'tui-editor/dist/tui-editor-contents.css' // editor content
import Editor from 'tui-editor'
// import Editor from 'tui-editor'
// import defaultOptions from './default-options'
import 'codemirror/lib/codemirror.css'
import '@toast-ui/editor/dist/toastui-editor.css'
import Editor from '@toast-ui/editor'
import defaultOptions from './default-options'
export default {
@ -62,8 +67,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 +95,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() {
@ -101,11 +106,11 @@ export default {
this.editor.off('change')
this.editor.remove()
},
setValue(value) {
this.editor.setValue(value)
setMarkdown(value) {
this.editor.setMarkdown(value)
},
getValue() {
return this.editor.getValue()
getMarkdown() {
return this.editor.getMarkdown()
},
setHtml(value) {
this.editor.setHtml(value)

View File

@ -1,3 +1,4 @@
// 这是fork到我github的项目
import Vue from 'vue'
import Cookies from 'js-cookie'