Browse Source

fix: remove redundant folder (#214)

pull/215/head
John Niang 4 years ago committed by GitHub
parent
commit
6f3ea8ef64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 62
      src/components/editor/MarkdownEditor.vue
  2. 34
      src/components/editor/RichTextEditor.vue

62
src/components/editor/MarkdownEditor.vue

@ -1,62 +0,0 @@
<template>
<div>
<halo-editor
ref="md"
v-model="originalContentData"
:boxShadow="false"
:toolbars="toolbars"
:ishljs="true"
:autofocus="false"
@imgAdd="handleAttachmentUpload"
@save="handleSaveDraft"
/>
</div>
</template>
<script>
import { toolbars } from '@/core/const'
import { haloEditor } from 'halo-editor'
import 'halo-editor/dist/css/index.css'
import attachmentApi from '@/api/attachment'
export default {
name: 'MarkdownEditor',
components: {
haloEditor
},
props: {
originalContent: {
type: String,
required: false,
default: ''
}
},
data() {
return {
toolbars,
originalContentData: ''
}
},
watch: {
originalContent(val) {
this.originalContentData = val
},
originalContentData(val) {
this.$emit('onContentChange', val)
}
},
methods: {
handleAttachmentUpload(pos, $file) {
var formdata = new FormData()
formdata.append('file', $file)
attachmentApi.upload(formdata).then(response => {
var responseObject = response.data
var HaloEditor = this.$refs.md
HaloEditor.$img2Url(pos, encodeURI(responseObject.data.path))
this.$message.success('图片上传成功!')
})
},
handleSaveDraft() {
this.$emit('onSaveDraft')
}
}
}
</script>

34
src/components/editor/RichTextEditor.vue

@ -1,34 +0,0 @@
<template>
<div>
<a-input
type="textarea"
v-model="originalContent"
:rows="16"
/>
</div>
</template>
<script>
export default {
name: 'RichTextEditor',
props: {
originalContent: {
type: String,
required: false,
default: ''
}
},
data() {
return {
originalContentData: ''
}
},
watch: {
originalContent(val) {
this.originalContentData = val
},
originalContentData(val) {
this.$emit('onContentChange', val)
}
}
}
</script>
Loading…
Cancel
Save