|
@@ -1,20 +1,16 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="tinymce-container editor-container">
|
|
<div class="tinymce-container editor-container">
|
|
|
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
|
|
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
|
|
|
- <div class="editor-custom-btn-container">
|
|
|
|
|
- <editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK"></editorImage>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import editorImage from './components/editorImage'
|
|
|
|
|
import plugins from './plugins'
|
|
import plugins from './plugins'
|
|
|
import toolbar from './toolbar'
|
|
import toolbar from './toolbar'
|
|
|
|
|
+import { createStorage } from '@/api/storage'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'tinymce',
|
|
name: 'tinymce',
|
|
|
- components: { editorImage },
|
|
|
|
|
props: {
|
|
props: {
|
|
|
id: {
|
|
id: {
|
|
|
type: String
|
|
type: String
|
|
@@ -68,6 +64,7 @@ export default {
|
|
|
window.tinymce.init({
|
|
window.tinymce.init({
|
|
|
selector: `#${this.tinymceId}`,
|
|
selector: `#${this.tinymceId}`,
|
|
|
height: this.height,
|
|
height: this.height,
|
|
|
|
|
+ language: 'zh_CN',
|
|
|
body_class: 'panel-body ',
|
|
body_class: 'panel-body ',
|
|
|
object_resizing: false,
|
|
object_resizing: false,
|
|
|
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
|
|
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
|
|
@@ -79,7 +76,6 @@ export default {
|
|
|
code_dialog_width: 1000,
|
|
code_dialog_width: 1000,
|
|
|
advlist_bullet_styles: 'square',
|
|
advlist_bullet_styles: 'square',
|
|
|
advlist_number_styles: 'default',
|
|
advlist_number_styles: 'default',
|
|
|
- imagetools_cors_hosts: ['www.tinymce.com', 'codepen.io'],
|
|
|
|
|
default_link_target: '_blank',
|
|
default_link_target: '_blank',
|
|
|
link_title: false,
|
|
link_title: false,
|
|
|
init_instance_callback: editor => {
|
|
init_instance_callback: editor => {
|
|
@@ -91,6 +87,15 @@ export default {
|
|
|
this.hasChange = true
|
|
this.hasChange = true
|
|
|
this.$emit('input', editor.getContent({ format: 'raw' }))
|
|
this.$emit('input', editor.getContent({ format: 'raw' }))
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ images_upload_handler: function(blobInfo, success, failure) {
|
|
|
|
|
+ const formData = new FormData()
|
|
|
|
|
+ formData.append('file', blobInfo.blob())
|
|
|
|
|
+ createStorage(formData).then(res => {
|
|
|
|
|
+ success(res.data.data.url)
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ failure('上传失败,请重新上传')
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
// 整合七牛上传
|
|
// 整合七牛上传
|
|
|
// images_dataimg_filter(img) {
|
|
// images_dataimg_filter(img) {
|