瀏覽代碼

HUE-4684 [editor] No placeholder showing up in new editors

Enrico Berti 9 年之前
父節點
當前提交
d3ee7b7
共有 1 個文件被更改,包括 8 次插入6 次删除
  1. 8 6
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

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

@@ -2740,15 +2740,17 @@
         }
       }
 
-      editor.on("input", function() {
-        if (editor.getValue().length == 0 && !placeHolderVisible) {
-          placeHolderElement.appendTo(editor.renderer.scroller);
-          placeHolderVisible = true;
-        } else if (placeHolderVisible) {
+      editor.on("input", function () {
+        if (editor.getValue().length == 0) {
+          if (!placeHolderVisible) {
+            placeHolderElement.appendTo(editor.renderer.scroller);
+            placeHolderVisible = true;
+          }
+        } else {
           placeHolderElement.remove();
           placeHolderVisible = false;
         }
-        if (options.updateOnInput){
+        if (options.updateOnInput) {
           snippet.statement_raw(removeUnicodes(editor.getValue()));
         }
       });