1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
<div class="ck-content">
<ckeditor :config="editorConfig" v-model="dataValue" ref="ckdt" :editor-url="editorUrl"></ckeditor>
</div>
</template>
<script>
import CKEditor from 'ckeditor4-vue';
import { getToken } from '@/utils/auth';
export default {
name :"CKEditor",
components: {
// Use the <ckeditor> component in this view.
ckeditor: CKEditor.component
},
props:{
value:String,
editorConfig:{
type:Object,
default:function(){
const _this = this
return {
// filebrowserUploadUrl:"/aaa",
// filebrowserImageUploadUrl:_this.apiUrl+"/system/upload/ckEditorUpImg",
// imageUploadUrl:_this.apiUrl+"/system/upload/ckEditorUpImg?token="+encodeURIComponent(getToken()),
toolbar: [{
name: 'document',
items: ['Print']
},
{
name: 'clipboard',
items: ['Undo', 'Redo']
},
{
name: 'styles',
items: ['Format', 'Font', 'FontSize']
},
{
name: 'colors',
items: ['TextColor', 'BGColor']
},
{
name: 'align',
items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
},
'/',
{
name: 'basicstyles',
items: ['Bold', 'Italic', 'Underline', 'Strike', 'RemoveFormat', 'CopyFormatting']
},
{
name: 'links',
items: ['Link', 'Unlink']
},
{
name: 'paragraph',
items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote']
},
{
name: 'insert',
items: ['Image', 'Table']
},
{
name: 'tools',
items: ['Maximize']
},
{
name: 'editing',
items: ['Scayt']
},
{
name:'source',
items:['Source']
}
],
extraAllowedContent: 'h3{clear};h2{line-height};h2 h3{margin-left,margin-top}',
// Adding drag and drop image upload.
extraPlugins: 'print,format,font,colorbutton,justify,uploadimage,divarea',
uploadUrl: _this.apiUrl+"/system/upload/ckEditorUp?command=QuickUpload&type=Files&token="+encodeURIComponent(getToken()),
// Configure your file manager integration. This example uses CKFinder 3 for PHP.
//filebrowserBrowseUrl: '/apps/ckfinder/3.4.5/ckfinder.html',
//filebrowserImageBrowseUrl: '/apps/ckfinder/3.4.5/ckfinder.html?type=Images',
filebrowserUploadUrl: _this.apiUrl+"/system/upload/ckEditorUp?command=QuickUpload&type=Files&token="+encodeURIComponent(getToken()),
filebrowserImageUploadUrl: _this.apiUrl+"/system/upload/ckEditorUp?command=QuickUpload&type=Images&token="+encodeURIComponent(getToken()),
width:'auto',
height: 420,
removeDialogTabs: 'image:advanced;link:advanced',
}
},
}
},
data() {
return {
editorUrl: "/js/ckeditor/ckeditor.js"
};
},
computed:{
dataValue:{
get(){
return this.value
},
set(data){
this.$emit('setEditContent',data)
},
}
},
methods:{
}
}
</script>
<style>
.ck-content {
font-family: 微软雅黑 宋体;
font-size:14px;
}
.ck-content p{
margin: 0 0 6px 0;
line-height: 22px;
text-indent: 2em;
}
</style>