Browse Source

表达式框,复制粘贴方法调整

MaiXinRong 5 years ago
parent
commit
69e0019203
1 changed files with 6 additions and 2 deletions
  1. 6 2
      app/public/js/stage_pay.js

+ 6 - 2
app/public/js/stage_pay.js

@@ -1197,7 +1197,11 @@ $(document).ready(() => {
     })
     })
 });
 });
 const pasteExpr = function (e, obj) {
 const pasteExpr = function (e, obj) {
-    const text = e.clipboardData.getData('text');
+    let text = e.clipboardData.getData('text');
     e.preventDefault();
     e.preventDefault();
-    obj.value = obj.value + trimInvalidChar(_.trim(text));
+    text = trimInvalidChar(_.trim(text));
+    const start = obj.selectionStart, end = obj.selectionEnd;
+    obj.value = obj.value.substr(0, start) + text + obj.value.substring(end, obj.value.length);
+    obj.selectionStart = start + text.length;
+    obj.selectionEnd = start + text.length;
 };
 };