From e0d810741064f92567a757cd6c1acfdeaf6c3801 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 5 Jan 2021 17:22:29 +0800 Subject: [PATCH] sync --- Roo/bootstrap/Markdown.js | 8 ++++++-- docs/src/Roo_bootstrap_Markdown.js.html | 18 ++++++++---------- roojs-bootstrap-debug.js | 8 ++++++-- roojs-bootstrap.js | 11 ++++++----- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Roo/bootstrap/Markdown.js b/Roo/bootstrap/Markdown.js index 3f4a390b27..8b0447e075 100644 --- a/Roo/bootstrap/Markdown.js +++ b/Roo/bootstrap/Markdown.js @@ -30,8 +30,12 @@ Roo.extend(Roo.bootstrap.Markdown, Roo.bootstrap.TextArea, { cls : 'roo-markdown-area' }); this.inputEl().addClass('d-none'); - - this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); + if (this.getValue() == '') { + this.markdownEl.dom.innerHTML = String.format('{0}', this.placeholder || ''); + + } else { + this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); + } this.markdownEl.on('click', this.toggleTextEdit, this); this.on('blur', this.toggleTextEdit, this); this.on('specialkey', this.resizeTextArea, this); diff --git a/docs/src/Roo_bootstrap_Markdown.js.html b/docs/src/Roo_bootstrap_Markdown.js.html index 2e1765fb38..953343a3c9 100644 --- a/docs/src/Roo_bootstrap_Markdown.js.html +++ b/docs/src/Roo_bootstrap_Markdown.js.html @@ -30,11 +30,12 @@ cls : 'roo-markdown-area' }); this.inputEl().addClass('d-none'); - var v = this.getValue(); - if (v === false) { - v = ''; + if (this.getValue() == '') { + this.markdownEl.dom.innerHTML = String.format('<span class="roo-placeholder">{0}</span>', this.placeholder || ''); + + } else { + this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); } - this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(v)); this.markdownEl.on('click', this.toggleTextEdit, this); this.on('blur', this.toggleTextEdit, this); this.on('specialkey', this.resizeTextArea, this); @@ -62,14 +63,11 @@ updateMarkdown : function() { if (this.getValue() == '') { - this.markdownEl.dom.innerHTML = String.format('<span class="roo-placeholder">{0}</span>', this.placeholder); + this.markdownEl.dom.innerHTML = String.format('<span class="roo-placeholder">{0}</span>', this.placeholder || ''); return; } - var v = this.getValue(); - if (v === false) { - v = ''; - } - this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(v)); + + this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); }, resizeTextArea: function () { diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index d284920d4b..0aa46f72b9 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -26142,8 +26142,12 @@ Roo.extend(Roo.bootstrap.Markdown, Roo.bootstrap.TextArea, { cls : 'roo-markdown-area' }); this.inputEl().addClass('d-none'); - - this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); + if (this.getValue() == '') { + this.markdownEl.dom.innerHTML = String.format('{0}', this.placeholder || ''); + + } else { + this.markdownEl.dom.innerHTML = Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); + } this.markdownEl.on('click', this.toggleTextEdit, this); this.on('blur', this.toggleTextEdit, this); this.on('specialkey', this.resizeTextArea, this); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 2515c984d4..831ff8fe59 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1095,11 +1095,12 @@ A.get('align-center').setActive(B.queryCommandState('justifycenter'));A.get('ali this.editor.toggleSourceEdit(A);}}); // Roo/bootstrap/Markdown.js Roo.bootstrap.Markdown=function(A){Roo.bootstrap.Markdown.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Markdown,Roo.bootstrap.TextArea,{editing:false,initEvents:function(){Roo.bootstrap.TextArea.prototype.initEvents.call(this);this.markdownEl=this.el.createChild({cls:'roo-markdown-area'} -);this.inputEl().addClass('d-none');this.markdownEl.dom.innerHTML=Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue()));this.markdownEl.on('click',this.toggleTextEdit,this);this.on('blur',this.toggleTextEdit,this);this.on('specialkey',this.resizeTextArea,this); -},toggleTextEdit:function(){var sh=this.markdownEl.getHeight();this.inputEl().addClass('d-none');this.markdownEl.addClass('d-none');if(!this.editing){this.inputEl().setHeight(Math.min(500,Math.max(sh,(this.getValue().split("\n").length+1)*30)));this.inputEl().removeClass('d-none'); -this.inputEl().focus();this.editing=true;return;}this.updateMarkdown();this.markdownEl.removeClass('d-none');this.editing=false;return;},updateMarkdown:function(){if(this.getValue()==''){this.markdownEl.dom.innerHTML=String.format('{0}',this.placeholder||''); -return;}this.markdownEl.dom.innerHTML=Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue()));},resizeTextArea:function(){var sh=100;Roo.log([sh,this.getValue().split("\n").length*30]);this.inputEl().setHeight(Math.min(500,Math.max(sh,(this.getValue().split("\n").length+1)*30))); -},setValue:function(A){Roo.bootstrap.TextArea.prototype.setValue.call(this,A);if(!this.editing){this.updateMarkdown();}},focus:function(){if(!this.editing){this.toggleTextEdit();}}}); +);this.inputEl().addClass('d-none');if(this.getValue()==''){this.markdownEl.dom.innerHTML=String.format('{0}',this.placeholder||'');}else{this.markdownEl.dom.innerHTML=Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); +}this.markdownEl.on('click',this.toggleTextEdit,this);this.on('blur',this.toggleTextEdit,this);this.on('specialkey',this.resizeTextArea,this);},toggleTextEdit:function(){var sh=this.markdownEl.getHeight();this.inputEl().addClass('d-none');this.markdownEl.addClass('d-none'); +if(!this.editing){this.inputEl().setHeight(Math.min(500,Math.max(sh,(this.getValue().split("\n").length+1)*30)));this.inputEl().removeClass('d-none');this.inputEl().focus();this.editing=true;return;}this.updateMarkdown();this.markdownEl.removeClass('d-none'); +this.editing=false;return;},updateMarkdown:function(){if(this.getValue()==''){this.markdownEl.dom.innerHTML=String.format('{0}',this.placeholder||'');return;}this.markdownEl.dom.innerHTML=Roo.Markdown.toHtml(Roo.util.Format.htmlEncode(this.getValue())); +},resizeTextArea:function(){var sh=100;Roo.log([sh,this.getValue().split("\n").length*30]);this.inputEl().setHeight(Math.min(500,Math.max(sh,(this.getValue().split("\n").length+1)*30)));},setValue:function(A){Roo.bootstrap.TextArea.prototype.setValue.call(this,A); +if(!this.editing){this.updateMarkdown();}},focus:function(){if(!this.editing){this.toggleTextEdit();}}}); // Roo/bootstrap/Table/AbstractSelectionModel.js Roo.bootstrap.Table.AbstractSelectionModel=function(){this.locked=false;Roo.bootstrap.Table.AbstractSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.bootstrap.Table.AbstractSelectionModel,Roo.util.Observable,{init:function(A){this.grid=A;this.initEvents(); },lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},initEvents:function(){}}); -- 2.39.2