X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=docs%2Fsrc%2FRoo_bootstrap_Modal.js.html;fp=docs%2Fsrc%2FRoo_bootstrap_Modal.js.html;h=655fd04e89c8d27e4d0a4440768059cb6698233b;hp=2f36942b409469bdf88d312b76154cbe664ea30e;hb=267f6bc0ecf0897515863c3c91a8eea23388e273;hpb=4806a3a6a72a6fc861a138965a6b1b5df60d0c87 diff --git a/docs/src/Roo_bootstrap_Modal.js.html b/docs/src/Roo_bootstrap_Modal.js.html index 2f36942b40..655fd04e89 100644 --- a/docs/src/Roo_bootstrap_Modal.js.html +++ b/docs/src/Roo_bootstrap_Modal.js.html @@ -20,6 +20,8 @@ * @cfg {Number} height fixed height - usefull for chrome extension only really. * @cfg {String} size (sm|lg) default empty * @cfg {Number} max_width set the max width of modal + * @cfg {Boolean} editableTitle can the title be edited + * * * @constructor @@ -43,8 +45,16 @@ * @param {Roo.bootstrap.Modal} this * @param {Roo.EventObject} e */ - "resize" : true - }); + "resize" : true, + /** + * @event titlechanged + * Fire when the editable title has been changed + * @param {Roo.bootstrap.Modal} this + * @param {Roo.EventObject} value + */ + "titlechanged" : true, + + }); this.buttons = this.buttons || []; if (this.tmpl) { @@ -89,6 +99,7 @@ max_height: 0, fit_content: false, + editableTitle : false, onRender : function(ct, position) { @@ -180,9 +191,8 @@ html : this.title }; - if(this.specificTitle){ + if(this.specificTitle){ // WTF is this? title = this.title; - } var header = []; @@ -196,6 +206,14 @@ header.push(title); + if (this.editableTitle) { + header.push({ + cls: 'form-control roo-editable-title d-none', + tag: 'input', + type: 'text' + }); + } + if (this.allow_close && Roo.bootstrap.version == 4) { header.push({ tag: 'button', @@ -278,7 +296,18 @@ this.closeEl.on('click', this.hide, this); } Roo.EventManager.onWindowResize(this.resize, this, true); - + if (this.editableTitle) { + this.headerEditEl = this.headerEl.select('.form-control',true).first(); + 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) + },this); + } }, @@ -485,6 +514,7 @@ */ setTitle: function(str) { this.titleEl.dom.innerHTML = str; + this.title = str; }, /** * Set the body of the Dialog @@ -512,7 +542,7 @@ !child_nodes || child_nodes.length == 0 ) { - return; + return 0; } var child_height = 0; @@ -565,6 +595,33 @@ } return child_height; + }, + toggleHeaderInput : function(is_edit) + { + + if (is_edit && this.is_header_editing) { + return; // already editing.. + } + if (is_edit) { + + 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.dom.value; + this.headerEditEl.addClass('d-none'); + this.titleEl.removeClass('d-none'); + this.titleEl.dom.innerHTML = String.format('{0}', this.title); + this.is_header_editing = false; + this.fireEvent('titlechanged', this, this.title); + + + } }); @@ -633,4 +690,5 @@ zIndex : 10001 }); + \ No newline at end of file