sone-ui-component-3.2.4 2.0.264 → 2.0.265
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/lib/sone-ui.common.js +75 -58
- package/lib/sone-ui.common.js.map +1 -1
- package/lib/sone-ui.css +1 -1
- package/lib/sone-ui.umd.js +75 -58
- package/lib/sone-ui.umd.js.map +1 -1
- package/lib/sone-ui.umd.min.js +3 -3
- package/lib/sone-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/editor/src/main.vue +34 -17
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: chenjuan
|
|
4
4
|
* @Date: 2021-08-31 08:42:40
|
|
5
|
-
* @LastEditTime:
|
|
6
|
-
* @LastEditors:
|
|
5
|
+
* @LastEditTime: 2023-12-28 16:58:58
|
|
6
|
+
* @LastEditors: lw
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
<template>
|
|
@@ -17,20 +17,20 @@ export default {
|
|
|
17
17
|
name: "SoneEditor",
|
|
18
18
|
components: {},
|
|
19
19
|
props: {
|
|
20
|
-
zindex:{
|
|
21
|
-
type:Number,
|
|
22
|
-
default:10000,
|
|
23
|
-
remark:
|
|
20
|
+
zindex: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 10000,
|
|
23
|
+
remark: "富文本层级",
|
|
24
24
|
},
|
|
25
25
|
disabled: {
|
|
26
26
|
type: Boolean,
|
|
27
27
|
default: false,
|
|
28
28
|
remark: "是否可编辑",
|
|
29
29
|
},
|
|
30
|
-
content:{
|
|
31
|
-
type:String,
|
|
32
|
-
default:"",
|
|
33
|
-
remark:"富文本的内容"
|
|
30
|
+
content: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "",
|
|
33
|
+
remark: "富文本的内容",
|
|
34
34
|
},
|
|
35
35
|
isVideo: {
|
|
36
36
|
type: Boolean,
|
|
@@ -101,6 +101,7 @@ export default {
|
|
|
101
101
|
data() {
|
|
102
102
|
return {
|
|
103
103
|
editor: null,
|
|
104
|
+
allImgUrl: [],
|
|
104
105
|
};
|
|
105
106
|
},
|
|
106
107
|
mounted() {
|
|
@@ -122,11 +123,11 @@ export default {
|
|
|
122
123
|
if (newV) {
|
|
123
124
|
this.$nextTick(() => {
|
|
124
125
|
// this.editor.$textElem.attr("contenteditable", false);
|
|
125
|
-
this.editor.disable()
|
|
126
|
+
this.editor.disable();
|
|
126
127
|
});
|
|
127
|
-
}else{
|
|
128
|
+
} else {
|
|
128
129
|
this.$nextTick(() => {
|
|
129
|
-
this.editor.enable()
|
|
130
|
+
this.editor.enable();
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
},
|
|
@@ -182,7 +183,7 @@ export default {
|
|
|
182
183
|
// 4.配置 onchange 回调函数,将数据同步到 vue 中
|
|
183
184
|
this.editor.config.onchange = (newHtml) => {
|
|
184
185
|
this.$emit("change", this.content);
|
|
185
|
-
this.$emit(
|
|
186
|
+
this.$emit("update:content", newHtml);
|
|
186
187
|
};
|
|
187
188
|
|
|
188
189
|
// 6.消息提示框
|
|
@@ -266,7 +267,7 @@ export default {
|
|
|
266
267
|
customInsert: function (insertImgFn, result) {
|
|
267
268
|
// result 即服务端返回的接口
|
|
268
269
|
console.log("customInsert", result);
|
|
269
|
-
|
|
270
|
+
that.allImgUrl.push(result.data[0]);
|
|
270
271
|
// insertImgFn 可把图片插入到编辑器,传入图片 src ,执行函数即可
|
|
271
272
|
insertImgFn(result.data[0]);
|
|
272
273
|
},
|
|
@@ -324,6 +325,22 @@ export default {
|
|
|
324
325
|
|
|
325
326
|
this.editor.create();
|
|
326
327
|
},
|
|
328
|
+
deleteImg() {
|
|
329
|
+
let imgList =
|
|
330
|
+
document
|
|
331
|
+
.getElementById(this.editor.textElemId)
|
|
332
|
+
.getElementsByTagName("img") || [];
|
|
333
|
+
let arr = [];
|
|
334
|
+
for (let index = 0; index < imgList.length; index++) {
|
|
335
|
+
arr.push(imgList[index].getAttribute("src"));
|
|
336
|
+
}
|
|
337
|
+
this.allImgUrl.forEach((v, i) => {
|
|
338
|
+
if (arr.includes(v)) {
|
|
339
|
+
this.allImgUrl.splice(i, 1);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
return this.allImgUrl;
|
|
343
|
+
},
|
|
327
344
|
},
|
|
328
345
|
beforeDestroy() {
|
|
329
346
|
// 调用销毁 API 对当前编辑器实例进行销毁
|
|
@@ -333,7 +350,7 @@ export default {
|
|
|
333
350
|
};
|
|
334
351
|
</script>
|
|
335
352
|
<style lang="scss" scoped>
|
|
336
|
-
::v-deep table{
|
|
337
|
-
display:table;
|
|
353
|
+
::v-deep table {
|
|
354
|
+
display: table;
|
|
338
355
|
}
|
|
339
356
|
</style>
|