17
This commit is contained in:
@@ -59,21 +59,22 @@
|
||||
this.textValue = e.detail.value;
|
||||
// 更新光标位置
|
||||
this.cursorPos = e.detail.cursor || this.textValue.length;
|
||||
this.$emit("input", {
|
||||
detail: {
|
||||
value: this.textValue,
|
||||
text: this.textValue,
|
||||
html: this.textValue // 简单编辑器,HTML 就是文本
|
||||
}
|
||||
this.$emit("onUserEvent", {
|
||||
"type":"input",
|
||||
text: this.textValue,
|
||||
html: this.textValue // 简单编辑器,HTML 就是文本
|
||||
});
|
||||
},
|
||||
onFocus(e) {
|
||||
this.$emit("focus", e);
|
||||
this.$emit("onUserEvent",{
|
||||
type:"focus",
|
||||
e
|
||||
});
|
||||
},
|
||||
onBlur(e) {
|
||||
// 保存光标位置
|
||||
this.cursorPos = e.detail.cursor || this.textValue.length;
|
||||
this.$emit("blur", e);
|
||||
this.$emit("onUserEvent",{type:"blur", e});
|
||||
},
|
||||
// 插入文本(表情或普通文本)
|
||||
insertText(text, successFn, errFn) {
|
||||
@@ -93,12 +94,10 @@
|
||||
this.cursorPos = newCursorPos;
|
||||
|
||||
// 触发 input 事件
|
||||
this.$emit("input", {
|
||||
detail: {
|
||||
value: newText,
|
||||
text: newText,
|
||||
html: newText
|
||||
}
|
||||
this.$emit("onUserEvent", {
|
||||
type:"input",
|
||||
html: newText,
|
||||
text: newText,
|
||||
});
|
||||
|
||||
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
||||
@@ -139,12 +138,10 @@
|
||||
clear() {
|
||||
this.textValue = "";
|
||||
this.cursorPos = 0;
|
||||
this.$emit("input", {
|
||||
detail: {
|
||||
value: "",
|
||||
text: "",
|
||||
html: ""
|
||||
}
|
||||
this.$emit("onUserEvent", {
|
||||
type:"input",
|
||||
text: "",
|
||||
html: ""
|
||||
});
|
||||
},
|
||||
// 删除(退格)
|
||||
@@ -180,12 +177,10 @@
|
||||
this.cursorPos = currentPos - deletedLength;
|
||||
|
||||
// 触发 input 事件
|
||||
this.$emit("input", {
|
||||
detail: {
|
||||
value: this.textValue,
|
||||
text: this.textValue,
|
||||
html: this.textValue
|
||||
}
|
||||
this.$emit("onUserEvent", {
|
||||
type:"input",
|
||||
text: this.textValue,
|
||||
html: this.textValue
|
||||
});
|
||||
|
||||
// 使用 $nextTick 确保 DOM 更新后再设置光标
|
||||
@@ -220,12 +215,12 @@
|
||||
|
||||
.simple_editor_textarea {
|
||||
width: 100%;
|
||||
min-height: 30px;
|
||||
min-height: 60rpx;
|
||||
max-height: 120px;
|
||||
line-height: 60rpx;
|
||||
background-color: #fff;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
padding: 4px;
|
||||
font-size: 30rpx;
|
||||
padding: 0 6rpx;
|
||||
word-break: break-all;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user