X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;h=e956860183116233b7b90207bfc4348535c8817a;hp=5473e97438380285d9ac03bd31a603402451885e;hb=refs%2Fheads%2Fwip_alan_T5944_trim_leading_white_space_from;hpb=925c9a04b7713ecfa3373668f038ed06aa114ed7 diff --git a/roojs-debug.js b/roojs-debug.js index 5473e97438..e956860183 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -39441,6 +39441,10 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { * @cfg {Boolean} selectOnFocus True to automatically select any existing field text when the field receives input focus (defaults to false) */ selectOnFocus : false, + /** + * @cfg {Boolean} allowLeadingSpace True to prevent the stripping of leading white space + */ + allowLeadingSpace : false, /** * @cfg {String} blankText Error text to display if the allow blank validation fails (defaults to "This field is required") */ @@ -39485,8 +39489,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { if(this.selectOnFocus){ this.on("focus", this.preFocus, this); - } + if (!this.allowLeadingSpace) { + this.on('blur', this.cleanLeadingSpace, this); + } + if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){ this.el.on("keypress", this.filterKeys, this); } @@ -39522,7 +39529,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { this.autoSize(); } }, - + // private - clean the leading white space + cleanLeadingSpace : function(e) + { + this.setValue(this.getValue().replace(/^\s+/,'')); + }, /** * Resets the current field value to the originally-loaded value and clears any validation messages. * @@ -39530,9 +39541,7 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { reset : function(){ Roo.form.TextField.superclass.reset.call(this); - }, - - + }, // private preFocus : function(){ @@ -44070,11 +44079,17 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.nodeName == 'SPAN' && !node.hasAttributes() && node.childNodes.length == 1 && - node.firstChild.nodeName == "#text" + node.firstChild.nodeName == "#text" ) { var textNode = node.firstChild; node.removeChild(textNode); + if (node.getAttribute('lang') != 'zh-CN') { // do not space pad on chinese characters.. + node.parentNode.insertBefore(node.ownerDocument.createTextNode(" "), node); + } node.parentNode.insertBefore(textNode, node); + if (node.getAttribute('lang') != 'zh-CN') { // do not space pad on chinese characters.. + node.parentNode.insertBefore(node.ownerDocument.createTextNode(" ") , node); + } node.parentNode.removeChild(node); }