From da8815fe0b782213a018af62ece47b4b23983a26 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 19 Nov 2020 16:59:21 +0800 Subject: [PATCH] Roo/bootstrap/Modal.js --- Roo/bootstrap/Modal.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Roo/bootstrap/Modal.js b/Roo/bootstrap/Modal.js index 00e7e31867..0df311ffd7 100644 --- a/Roo/bootstrap/Modal.js +++ b/Roo/bootstrap/Modal.js @@ -298,6 +298,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, { } Roo.EventManager.onWindowResize(this.resize, this, true); if (this.editable_title) { + this.headerEditEl = this.headerEl.select('.form-control',true).first(); this.headerEl.on('click', this.showHeaderInput, this); } @@ -587,9 +588,29 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, { return child_height; }, - showHeaderInput : function() { + toggleHeaderInput : function(is_edit) + { + if (is_edit && this.is_header_editing) { + return; // already editing.. + } + if (is_edit) { + + this.headerEditEl.setValue(this.title); + this.headerEditEl.removeClass('d-none'); + this.titleEl.addClass('d-none'); + this.is_header_editing = true; + return + } + // flip back to not editing. + this.title = this.headerEditEl.getValue(this.title); + this.headerEditEl.addClass('d-none'); + this.titleEl.removeClass('d-none'); + this.titleEl.dom.innerHTML = String.format('{0}', this.title); + this.is_header_editing = false; + return + } -- 2.39.2