@lambo-design/wang-editor 1.0.0-beta.1 → 1.0.0-beta.10
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/index.js +1 -0
- package/package.json +11 -4
- package/src/index.vue +42 -21
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/wang-editor",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -13,8 +13,15 @@
|
|
|
13
13
|
"wangeditor": "^3.1.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@lambo-design/core": "^4.7.1-beta.
|
|
17
|
-
"@lambo-design/shared": "^1.0.0-beta.
|
|
16
|
+
"@lambo-design/core": "^4.7.1-beta.167",
|
|
17
|
+
"@lambo-design/shared": "^1.0.0-beta.274"
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
19
|
+
"scripts": {
|
|
20
|
+
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
|
21
|
+
"release-major": "standard-version --release-as major",
|
|
22
|
+
"release-minor": "standard-version --release-as minor",
|
|
23
|
+
"release-patch": "standard-version --release-as patch",
|
|
24
|
+
"release-beta": "standard-version --prerelease beta",
|
|
25
|
+
"re-publish": "pnpm publish --access public --no-git-checks"
|
|
26
|
+
}
|
|
20
27
|
}
|
package/src/index.vue
CHANGED
|
@@ -39,6 +39,13 @@ export default {
|
|
|
39
39
|
type: Boolean,
|
|
40
40
|
default: true
|
|
41
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* @description 是否使用 base64 保存图片
|
|
44
|
+
*/
|
|
45
|
+
uploadImgShowBase64: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
42
49
|
/**
|
|
43
50
|
* 上传图片上下文
|
|
44
51
|
*/
|
|
@@ -58,10 +65,23 @@ export default {
|
|
|
58
65
|
*/
|
|
59
66
|
ossFileGetImgUrl: {
|
|
60
67
|
type: String,
|
|
61
|
-
default: "/oss/file/
|
|
68
|
+
default: "/oss/file/get/"
|
|
62
69
|
},
|
|
63
70
|
|
|
64
71
|
},
|
|
72
|
+
watch: {
|
|
73
|
+
value: {
|
|
74
|
+
handler: function (newVal, oldVal) {
|
|
75
|
+
if (oldVal === '') {
|
|
76
|
+
if (this.valueType === 'html') {
|
|
77
|
+
this.editor.txt.html(newVal)
|
|
78
|
+
} else {
|
|
79
|
+
this.editor.txt.text(newVal)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
},
|
|
65
85
|
computed: {
|
|
66
86
|
editorId() {
|
|
67
87
|
return `editor${this._uid}`
|
|
@@ -88,14 +108,14 @@ export default {
|
|
|
88
108
|
// 设置触发事件间隔
|
|
89
109
|
self.editor.customConfig.onchangeTimeout = this.changeInterval
|
|
90
110
|
|
|
91
|
-
self.editor.customConfig.zIndex =
|
|
111
|
+
self.editor.customConfig.zIndex = 999
|
|
92
112
|
|
|
93
113
|
// 配置debug模式
|
|
94
114
|
self.editor.customConfig.debug = true
|
|
95
115
|
// 隐藏“网络图片”tab
|
|
96
116
|
self.editor.customConfig.showLinkImg = false
|
|
97
117
|
// 使用 base64 保存图片
|
|
98
|
-
|
|
118
|
+
self.editor.customConfig.uploadImgShowBase64 = self.uploadImgShowBase64
|
|
99
119
|
// 上传图片到服务器
|
|
100
120
|
// this.editor.customConfig.uploadImgServer = config.ossServerContext + "/file/wangeditor/put"
|
|
101
121
|
//
|
|
@@ -105,26 +125,27 @@ export default {
|
|
|
105
125
|
// =""
|
|
106
126
|
}
|
|
107
127
|
let ossServer = this.ossServerContext;
|
|
108
|
-
self.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// files 是 input 中选中的文件列表
|
|
114
|
-
// insert 是获取图片 url 后,插入到编辑器的方法
|
|
115
|
-
axios.post(ossServer + self.ossFilePutUrl, formData).then(response => {
|
|
116
|
-
if (response.data.code == "1") {
|
|
117
|
-
var result = response.data.data;
|
|
118
|
-
// 上传代码返回结果之后,将图片插入到编辑器中
|
|
119
|
-
let imgUrl = []
|
|
120
|
-
result.forEach(item => {
|
|
121
|
-
insert(ossServer + self.ossFileGetImgUrl + item.fileId)
|
|
122
|
-
// imgUrl.push()
|
|
123
|
-
})
|
|
124
|
-
|
|
128
|
+
if(!self.uploadImgShowBase64){
|
|
129
|
+
self.editor.customConfig.customUploadImg = function (files, insert) {
|
|
130
|
+
let formData = new FormData();
|
|
131
|
+
for (let file of files) {
|
|
132
|
+
formData.append('file', file);
|
|
125
133
|
}
|
|
126
|
-
|
|
134
|
+
// files 是 input 中选中的文件列表
|
|
135
|
+
// insert 是获取图片 url 后,插入到编辑器的方法
|
|
136
|
+
axios.post(ossServer + self.ossFilePutUrl, formData).then(response => {
|
|
137
|
+
if (response.data.code == "1") {
|
|
138
|
+
var result = response.data.data;
|
|
139
|
+
// 上传代码返回结果之后,将图片插入到编辑器中
|
|
140
|
+
let imgUrl = []
|
|
141
|
+
result.forEach(item => {
|
|
142
|
+
insert(ossServer + self.ossFileGetImgUrl + item.fileId)
|
|
143
|
+
// imgUrl.push()
|
|
144
|
+
})
|
|
127
145
|
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}
|
|
128
149
|
|
|
129
150
|
}
|
|
130
151
|
// 自定义菜单配置
|