소스 검색

shortcut.js - fix ENTER not clearing the @

Vijayakrishnan 3 년 전
부모
커밋
95b3c480a7
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      public/js/shortcut.js

+ 3 - 2
public/js/shortcut.js

@@ -83,7 +83,7 @@
             menu.find('.sc:eq(' + index + ')').addClass('active');
         }
     }
-    function apply() {
+    function apply(_clearReturn = false) {
         if(input && options && options.length && index >= 0 && index < options.length) {
             // $(input).focus();
             if(backtrackAfterApplying) {
@@ -91,6 +91,7 @@
                     document.execCommand("delete", true, null);
                 }
             }
+            if(_clearReturn) document.execCommand("delete", true, null);
             document.execCommand("insertText", true, options[index].value);
             discard();
         }
@@ -181,7 +182,7 @@
                         break;
                     case 13:
                         if(!isVisible()) return;
-                        apply();
+                        apply(true);
                         consumed = true;
                         break;
                     case 8: