Roo/bootstrap/Modal.js
[roojs1] / Roo / bootstrap / Modal.js
index d631877..c1e7947 100644 (file)
@@ -298,7 +298,15 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         Roo.EventManager.onWindowResize(this.resize, this, true);
         if (this.editableTitle) {
             this.headerEditEl =  this.headerEl.select('.form-control',true).first();
-            this.headerEl.on('click', this.showHeaderInput, this);
+            this.headerEl.on('click', function() { this.toggleHeaderInput(true) } , this);
+            this.headerEditEl.on('keyup', function(e) {
+                    if(e.isNavKeyPress()){
+                            this.toggleHeaderInput(false)
+                    }
+                }, this);
+            this.headerEditEl.on('blur', function(e) {
+                this.toggleHeaderInput(false)
+            });
         }
 
     },
@@ -506,6 +514,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
      */
     setTitle: function(str) {
         this.titleEl.dom.innerHTML = str;
+        this.title = str;
     },
     /**
      * Set the body of the Dialog
@@ -595,14 +604,16 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         }
         if (is_edit) {
     
-            this.headerEditEl.setValue(this.title);
+            this.headerEditEl.dom.value = this.title;
             this.headerEditEl.removeClass('d-none');
+            this.headerEditEl.dom.focus();
             this.titleEl.addClass('d-none');
+            
             this.is_header_editing = true;
             return
         }
         // flip back to not editing.
-        this.title = this.headerEditEl.getValue(this.title);
+        this.title = this.headerEditEl.dom.value;
         this.headerEditEl.addClass('d-none');
         this.titleEl.removeClass('d-none');
         this.titleEl.dom.innerHTML = String.format('{0}', this.title);