tenghui-ui 2.4.10 → 2.4.12
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/tenghui-ui.es.js
CHANGED
|
@@ -22435,10 +22435,17 @@ const __vue2_script$2 = {
|
|
|
22435
22435
|
data() {
|
|
22436
22436
|
return {
|
|
22437
22437
|
quillRef: null,
|
|
22438
|
-
modelForm: this.model
|
|
22438
|
+
modelForm: this.model,
|
|
22439
|
+
composition: false
|
|
22439
22440
|
};
|
|
22440
22441
|
},
|
|
22441
22442
|
methods: {
|
|
22443
|
+
handleRenderInput: debounce(300, (_this) => {
|
|
22444
|
+
const htmlVal = _this.handleGetVal();
|
|
22445
|
+
if (!_this.composition) {
|
|
22446
|
+
_this.modelForm = htmlVal;
|
|
22447
|
+
}
|
|
22448
|
+
}),
|
|
22442
22449
|
handleGetVal() {
|
|
22443
22450
|
const delta = this.quillRef.getContents();
|
|
22444
22451
|
const tempContainer = document.createElement("div");
|
|
@@ -22450,16 +22457,22 @@ const __vue2_script$2 = {
|
|
|
22450
22457
|
hadnleSelectionChange(focus) {
|
|
22451
22458
|
if (!focus) {
|
|
22452
22459
|
const htmlVal = this.handleGetVal();
|
|
22460
|
+
this.$emit("inputtext", htmlVal);
|
|
22453
22461
|
this.$emit("onBlur", htmlVal);
|
|
22454
22462
|
}
|
|
22455
22463
|
},
|
|
22456
22464
|
handleInput(d, od, source) {
|
|
22457
|
-
|
|
22458
|
-
this.modelForm = htmlVal;
|
|
22465
|
+
this.handleRenderInput(this);
|
|
22459
22466
|
},
|
|
22460
22467
|
handleSetValue(val) {
|
|
22461
22468
|
const delta = this.quillRef.clipboard.convert(val);
|
|
22462
22469
|
this.quillRef.setContents(delta, "silent");
|
|
22470
|
+
},
|
|
22471
|
+
handleCompositionstart() {
|
|
22472
|
+
this.composition = true;
|
|
22473
|
+
},
|
|
22474
|
+
handleCompositionend() {
|
|
22475
|
+
this.composition = false;
|
|
22463
22476
|
}
|
|
22464
22477
|
},
|
|
22465
22478
|
mounted() {
|
|
@@ -22468,16 +22481,25 @@ const __vue2_script$2 = {
|
|
|
22468
22481
|
});
|
|
22469
22482
|
this.quillRef.on("text-change", this.handleInput);
|
|
22470
22483
|
this.quillRef.on("selection-change", this.hadnleSelectionChange);
|
|
22484
|
+
document.querySelector(".ql-editor").addEventListener("compositionstart", this.handleCompositionstart);
|
|
22485
|
+
document.querySelector(".ql-editor").addEventListener("compositionend", this.handleCompositionend);
|
|
22471
22486
|
this.$emit("onCreated", this.quillRef);
|
|
22472
22487
|
this.handleSetValue(this.modelForm || "");
|
|
22473
22488
|
},
|
|
22474
22489
|
beforeDestroy() {
|
|
22490
|
+
var _a, _b;
|
|
22491
|
+
(_a = document.querySelector(".ql-editor")) == null ? void 0 : _a.removeEventListener("compositionstart", this.handleCompositionstart);
|
|
22492
|
+
(_b = document.querySelector(".ql-editor")) == null ? void 0 : _b.removeEventListener("compositionend", this.handleCompositionend);
|
|
22475
22493
|
this.quillRef.off("text-change", this.handleInput);
|
|
22476
22494
|
this.quillRef.off("selection-change", this.hadnleSelectionChange);
|
|
22477
22495
|
},
|
|
22478
22496
|
watch: {
|
|
22479
|
-
model(val) {
|
|
22497
|
+
model(val, oldVal) {
|
|
22498
|
+
if (this.modelForm == val) {
|
|
22499
|
+
return;
|
|
22500
|
+
}
|
|
22480
22501
|
this.modelForm = val;
|
|
22502
|
+
this.handleSetValue(val || "");
|
|
22481
22503
|
},
|
|
22482
22504
|
modelForm(val) {
|
|
22483
22505
|
this.$emit("inputtext", val);
|
|
@@ -22485,7 +22507,7 @@ const __vue2_script$2 = {
|
|
|
22485
22507
|
}
|
|
22486
22508
|
};
|
|
22487
22509
|
const __cssModules$2 = {};
|
|
22488
|
-
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, "
|
|
22510
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, "009bd892", null, null);
|
|
22489
22511
|
function __vue2_injectStyles$2(context) {
|
|
22490
22512
|
for (let o in __cssModules$2) {
|
|
22491
22513
|
this[o] = __cssModules$2[o];
|