Jelajahi Sumber

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

Enrico Berti 9 tahun lalu
induk
melakukan
d3ee7b7

+ 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()));
         }
       });