|
@@ -111,7 +111,7 @@ export default {
|
111
|
111
|
imgSrc.indexOf("http://") > -1 ||
|
112
|
112
|
imgSrc.indexOf("https://") > -1
|
113
|
113
|
) {
|
114
|
|
- if (imgSrc.indexOf(that.$api.showImageUrl) == -1) {
|
|
114
|
+ if (imgSrc.indexOf(that.$api.showImageUrl) === -1) {
|
115
|
115
|
that.imgsObj[imgSrc] = "";
|
116
|
116
|
}
|
117
|
117
|
}
|
|
@@ -186,7 +186,6 @@ export default {
|
186
|
186
|
return new Promise(function (resolve, reject) {
|
187
|
187
|
let ImgObj = new Image();
|
188
|
188
|
ImgObj.src = imgUrl;
|
189
|
|
- ImgObj.setAttribute("crossOrigin", "Anonymous");
|
190
|
189
|
ImgObj.onload = function () {
|
191
|
190
|
resolve(imgUrl);
|
192
|
191
|
};
|
|
@@ -198,8 +197,8 @@ export default {
|
198
|
197
|
changeImageUrl(imgSrc) {
|
199
|
198
|
let that = this;
|
200
|
199
|
let formData = new FormData();
|
201
|
|
- formData.append("newpath", "news");
|
202
|
|
- formData.append("filepath", imgSrc);
|
|
200
|
+ formData.append("newpath", imgSrc);
|
|
201
|
+ formData.append("filepath", "news");
|
203
|
202
|
that
|
204
|
203
|
.axios({
|
205
|
204
|
method: "POST",
|
|
@@ -213,6 +212,16 @@ export default {
|
213
|
212
|
.then((res) => {
|
214
|
213
|
if (!res.data.code) {
|
215
|
214
|
that.imgsObj[imgSrc] = res.data.obj;
|
|
215
|
+ if (that.myCkeditor && that.myCkeditor.document.getBody().$) {
|
|
216
|
+ let oldhtml = that.myCkeditor.document.getBody().getHtml();
|
|
217
|
+ if (oldhtml) {
|
|
218
|
+ let newhtml = oldhtml.replaceAll(
|
|
219
|
+ imgSrc,
|
|
220
|
+ that.$api.showImageUrl + res.data.obj
|
|
221
|
+ );
|
|
222
|
+ that.setContent(newhtml);
|
|
223
|
+ }
|
|
224
|
+ }
|
216
|
225
|
} else {
|
217
|
226
|
that.$Message.error(res.data.msg);
|
218
|
227
|
}
|