Jelajahi Sumber

Merge branch 'fix_4439_smartreport' into custom

jwyu 6 bulan lalu
induk
melakukan
adf462e5d2
1 mengubah file dengan 7 tambahan dan 3 penghapusan
  1. 7 3
      src/views/smartReport/components/TextEdit.vue

+ 7 - 3
src/views/smartReport/components/TextEdit.vue

@@ -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()