@zscreate/zhxy-app-component 1.0.97 → 1.0.98
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/components/rich-editor/index.vue +33 -17
- package/package.json +1 -1
|
@@ -69,10 +69,14 @@
|
|
|
69
69
|
<!-- <i class="iconfont icon-baocun" @tap="store" id="1"></i>-->
|
|
70
70
|
</view>
|
|
71
71
|
<view class="container">
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
<!-- <node-text-->
|
|
73
|
+
<rich-text v-if="widget.options.disabled" :nodes="value" style="width: 100%;"></rich-text>
|
|
74
|
+
<template v-else>
|
|
75
|
+
<editor ref="editor" id="editor" show-img-size :read-only="readOnly || isEdit" show-img-resize show-img-toolbar class="ql-container"
|
|
76
|
+
:placeholder="placeholder" @statuschange="onStatusChange" @ready="onEditorReady" @input="handleInput">
|
|
77
|
+
</editor>
|
|
78
|
+
<view v-if="maxLength" class="text-num">{{textLength}}/{{maxLength}}</view>
|
|
79
|
+
</template>
|
|
76
80
|
</view>
|
|
77
81
|
<tColorPicker ref="colorPicker" :color="color" @confirm="confirm" @cancel="cancel"></tColorPicker>
|
|
78
82
|
</view>
|
|
@@ -95,6 +99,7 @@
|
|
|
95
99
|
b: 0,
|
|
96
100
|
a: 0.6
|
|
97
101
|
},
|
|
102
|
+
readOnly: true,
|
|
98
103
|
isEdit: false,
|
|
99
104
|
fontColor: '#000',
|
|
100
105
|
formats: {},
|
|
@@ -143,21 +148,32 @@
|
|
|
143
148
|
this.$forceUpdate();
|
|
144
149
|
},
|
|
145
150
|
onEditorReady() {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
uni.createSelectorQuery().in(this).select('#editor').context((res) => {
|
|
152
|
+
this.editorCtx = res.context;
|
|
153
|
+
console.log(this.editorCtx, res)
|
|
154
|
+
if (this.value) {
|
|
155
|
+
this.editorCtx.setContents({
|
|
156
|
+
html: this.value,
|
|
157
|
+
success: (res) => {
|
|
158
|
+
console.log(res)
|
|
159
|
+
this.editorCtx.blur()
|
|
160
|
+
},
|
|
161
|
+
complete: () => {
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
this.editorCtx.getContents({
|
|
167
|
+
success: (res) => {
|
|
168
|
+
this.textLength = res.text.replaceAll(`\n`,"").length
|
|
169
|
+
},
|
|
152
170
|
})
|
|
153
|
-
|
|
171
|
+
setTimeout(() => {
|
|
172
|
+
this.readOnly = false
|
|
173
|
+
}, 1000)
|
|
174
|
+
|
|
175
|
+
}).exec();
|
|
154
176
|
|
|
155
|
-
this.editorCtx.getContents({
|
|
156
|
-
success: (res) => {
|
|
157
|
-
this.textLength = res.text.replaceAll(`\n`,"").length
|
|
158
|
-
},
|
|
159
|
-
})
|
|
160
|
-
}).exec();
|
|
161
177
|
},
|
|
162
178
|
undo() {
|
|
163
179
|
this.editorCtx.undo();
|