|
@@ -90,18 +90,22 @@ export default {
|
|
|
keyup: function (e, editor) {
|
|
|
//添加事件,在每次按键按下时,都记录一下最后停留位置
|
|
|
that.$nextTick(function () {
|
|
|
- that.lastEditRange = getSelection().getRangeAt(0);
|
|
|
+ getSelection().rangeCount &&
|
|
|
+ (that.lastEditRange = getSelection().getRangeAt(0));
|
|
|
});
|
|
|
},
|
|
|
click: function (e, editor) {
|
|
|
//添加事件,在每次鼠标点击时,都记录一下最后停留位置
|
|
|
that.$nextTick(function () {
|
|
|
- that.lastEditRange = getSelection().getRangeAt(0);
|
|
|
+ getSelection().rangeCount &&
|
|
|
+ (that.lastEditRange = getSelection().getRangeAt(0));
|
|
|
});
|
|
|
},
|
|
|
//内容改变事件
|
|
|
contentChanged: function () {
|
|
|
- that.lastEditRange = getSelection().getRangeAt(0) || 0;
|
|
|
+ that.lastEditRange = getSelection().rangeCount
|
|
|
+ ? getSelection().getRangeAt(0)
|
|
|
+ : 0;
|
|
|
|
|
|
// that.$emit('textChange', that.html)
|
|
|
that.sendHtml()
|