Parcourir la source

HUE-6154 [core] Ace paste event shouldn't reset the cursor position

Enrico Berti il y a 8 ans
Parent
commit
181f585
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 2 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3569,9 +3569,11 @@
         window.clearInterval(checkEditorValueInterval);
         window.clearInterval(checkEditorValueInterval);
         checkEditorValueInterval = window.setInterval(function () {
         checkEditorValueInterval = window.setInterval(function () {
           if (lastEditorValue !== editor.getValue()) {
           if (lastEditorValue !== editor.getValue()) {
+            var lastKnownPosition = editor.getCursorPosition();
             window.clearInterval(checkEditorValueInterval);
             window.clearInterval(checkEditorValueInterval);
             lastEditorValue = editor.getValue();
             lastEditorValue = editor.getValue();
             editor.setValue(removeUnicodes(lastEditorValue), 1);
             editor.setValue(removeUnicodes(lastEditorValue), 1);
+            editor.moveCursorToPosition(lastKnownPosition);
           }
           }
         }, 10);
         }, 10);
       });
       });