lw-cdp-ui 1.0.39 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/lwEditor/index.vue +28 -109
- package/dist/lw-cdp-ui.esm.js +12110 -3026
- package/dist/lw-cdp-ui.esm.js.map +1 -1
- package/dist/lw-cdp-ui.umd.js +67 -14
- package/dist/lw-cdp-ui.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -5
|
@@ -1,134 +1,53 @@
|
|
|
1
|
-
|
|
2
1
|
<template>
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@onClick="onClick" />
|
|
2
|
+
<div>
|
|
3
|
+
<QuillEditor
|
|
4
|
+
v-model="content"
|
|
5
|
+
:options="editorOptions"
|
|
6
|
+
/>
|
|
9
7
|
</div>
|
|
10
8
|
</template>
|
|
11
9
|
|
|
12
10
|
<script>
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import 'tinymce/themes/silver'
|
|
16
|
-
import 'tinymce/icons/default'
|
|
17
|
-
import 'tinymce/models/dom'
|
|
18
|
-
|
|
19
|
-
// 引入编辑器插件
|
|
20
|
-
import 'tinymce/plugins/code' //编辑源码
|
|
21
|
-
import 'tinymce/plugins/image' //插入编辑图片
|
|
22
|
-
import 'tinymce/plugins/media' //插入视频
|
|
23
|
-
import 'tinymce/plugins/link' //超链接
|
|
24
|
-
import 'tinymce/plugins/preview'//预览
|
|
25
|
-
import 'tinymce/plugins/template'//模板
|
|
26
|
-
import 'tinymce/plugins/table' //表格
|
|
27
|
-
import 'tinymce/plugins/pagebreak' //分页
|
|
28
|
-
import 'tinymce/plugins/lists' //列
|
|
29
|
-
import 'tinymce/plugins/advlist' //列
|
|
30
|
-
import 'tinymce/plugins/quickbars' //快速工具条
|
|
31
|
-
import 'tinymce/plugins/fullscreen' //全屏
|
|
11
|
+
import { QuillEditor } from '@vueup/vue-quill'
|
|
12
|
+
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
|
32
13
|
|
|
33
14
|
export default {
|
|
15
|
+
name: 'QuillEditorComponent',
|
|
34
16
|
components: {
|
|
35
|
-
|
|
17
|
+
QuillEditor,
|
|
36
18
|
},
|
|
37
19
|
props: {
|
|
38
20
|
modelValue: {
|
|
39
21
|
type: String,
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
placeholder: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: ""
|
|
45
|
-
},
|
|
46
|
-
height: {
|
|
47
|
-
type: Number,
|
|
48
|
-
default: 300,
|
|
49
|
-
},
|
|
50
|
-
disabled: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
plugins: {
|
|
55
|
-
type: [String, Array],
|
|
56
|
-
default: 'code image media link preview table quickbars template pagebreak lists advlist fullscreen'
|
|
22
|
+
required: true,
|
|
57
23
|
},
|
|
58
|
-
|
|
59
|
-
type:
|
|
60
|
-
default:
|
|
61
|
-
alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | pagebreak | \
|
|
62
|
-
image media table template preview | code selectall'
|
|
24
|
+
options: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({}),
|
|
63
27
|
},
|
|
64
|
-
templates: {
|
|
65
|
-
type: Array,
|
|
66
|
-
default: () => []
|
|
67
|
-
}
|
|
68
28
|
},
|
|
69
29
|
data() {
|
|
70
30
|
return {
|
|
71
|
-
|
|
72
|
-
language_url: 'tinymce/langs/zh_CN.js',
|
|
73
|
-
language: 'zh_CN',
|
|
74
|
-
skin_url: 'tinymce/skins/ui/oxide',
|
|
75
|
-
content_css: "tinymce/skins/content/default/content.css",
|
|
76
|
-
menubar: false,
|
|
77
|
-
statusbar: true,
|
|
78
|
-
plugins: this.plugins,
|
|
79
|
-
toolbar: this.toolbar,
|
|
80
|
-
font_size_formats: '12px 14px 16px 18px 22px 24px 36px 72px',
|
|
81
|
-
height: this.height,
|
|
82
|
-
placeholder: this.placeholder,
|
|
83
|
-
branding: false,
|
|
84
|
-
resize: true,
|
|
85
|
-
elementpath: true,
|
|
86
|
-
content_style: "",
|
|
87
|
-
templates: this.templates,
|
|
88
|
-
quickbars_selection_toolbar: 'forecolor backcolor bold italic underline strikethrough link',
|
|
89
|
-
quickbars_image_toolbar: 'alignleft aligncenter alignright',
|
|
90
|
-
quickbars_insert_toolbar: false,
|
|
91
|
-
image_caption: true,
|
|
92
|
-
image_advtab: true,
|
|
93
|
-
images_upload_handler: function (blobInfo) {
|
|
94
|
-
return new Promise((resolve, reject) => {
|
|
95
|
-
const data = new FormData();
|
|
96
|
-
data.append("file", blobInfo.blob(), blobInfo.filename());
|
|
97
|
-
this.$api.auth.upload(data).then((res) => {
|
|
98
|
-
resolve(`${res.data.loca}${res.data.path}`)
|
|
99
|
-
}).catch(() => {
|
|
100
|
-
reject("Image upload failed")
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
},
|
|
104
|
-
setup: function (editor) {
|
|
105
|
-
editor.on('init', function () {
|
|
106
|
-
this.getBody().style.fontSize = '14px';
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
contentValue: this.modelValue
|
|
31
|
+
content: this.modelValue,
|
|
112
32
|
}
|
|
113
33
|
},
|
|
114
34
|
watch: {
|
|
115
|
-
modelValue(
|
|
116
|
-
this.
|
|
35
|
+
modelValue(newValue) {
|
|
36
|
+
if (newValue !== this.content) {
|
|
37
|
+
this.content = newValue
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
content(newValue) {
|
|
41
|
+
this.$emit('update:modelValue', newValue)
|
|
117
42
|
},
|
|
118
|
-
contentValue(val) {
|
|
119
|
-
this.$emit('update:modelValue', val);
|
|
120
|
-
}
|
|
121
43
|
},
|
|
122
|
-
|
|
123
|
-
|
|
44
|
+
computed: {
|
|
45
|
+
editorOptions() {
|
|
46
|
+
return {
|
|
47
|
+
theme: 'snow',
|
|
48
|
+
...this.options,
|
|
49
|
+
}
|
|
50
|
+
},
|
|
124
51
|
},
|
|
125
|
-
methods: {
|
|
126
|
-
onClick(e) {
|
|
127
|
-
this.$emit('onClick', e, tinymce)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
52
|
}
|
|
131
53
|
</script>
|
|
132
|
-
|
|
133
|
-
<style>
|
|
134
|
-
</style>
|