Browse Source

HUE-3824 [editor] D&d table for a select adds an extra space before the statement

Johan Ahlen 9 years ago
parent
commit
6515358980
1 changed files with 2 additions and 2 deletions
  1. 2 2
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

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

@@ -2963,7 +2963,7 @@
 
 
       var setFromDropMenu = function (text) {
       var setFromDropMenu = function (text) {
         var before = editor.getTextBeforeCursor();
         var before = editor.getTextBeforeCursor();
-        if (before.length > 0 && before.charAt(before.length - 1) !== ' ') {
+        if (/\S+$/.test(before)) {
           text = " " + text;
           text = " " + text;
         }
         }
         editor.session.insert(editor.getCursorPosition(), text);
         editor.session.insert(editor.getCursorPosition(), text);
@@ -3007,7 +3007,7 @@
           if (draggableMeta.table && ! draggableMeta.column && /.*;|^\s*$/.test(before)) {
           if (draggableMeta.table && ! draggableMeta.column && /.*;|^\s*$/.test(before)) {
             menu.show(event);
             menu.show(event);
           } else {
           } else {
-            if (before.length > 0 && before.charAt(before.length - 1) !== ' ' && before.charAt(before.length - 1) !== '.') {
+            if (/\S+$/.test(before) && before.charAt(before.length - 1) !== '.') {
               text = " " + text;
               text = " " + text;
             }
             }
             var after = editor.getTextAfterCursor();
             var after = editor.getTextAfterCursor();