X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;h=130983fd41fb57aacdeb475236577cb9a4064767;hp=c44698cda55f21a8136068a1a3ffd37fb433b1cd;hb=refs%2Fheads%2Fwip_alan_T6102_issue_with_word_clean;hpb=bbea05ba2ddfd77b500f7065e9081f94e407e4d9 diff --git a/roojs-debug.js b/roojs-debug.js index c44698cda5..130983fd41 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,15 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { this.autoSize(); } }, - + // private - clean the leading white space + cleanLeadingSpace : function(e) + { + if ( this.inputType == 'file') { + return; + } + + this.setValue((this.getValue() + '').replace(/^\s+/,'')); + }, /** * Resets the current field value to the originally-loaded value and clears any validation messages. * @@ -39530,9 +39545,7 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { reset : function(){ Roo.form.TextField.superclass.reset.call(this); - }, - - + }, // private preFocus : function(){ @@ -40284,7 +40297,8 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField, { * Create a new DateField * @param {Object} config */ -Roo.form.DateField = function(config){ +Roo.form.DateField = function(config) +{ Roo.form.DateField.superclass.constructor.call(this, config); this.addEvents({ @@ -40632,7 +40646,13 @@ dateField.setValue('2006-5-4'); return String(this.getValue()) !== String(this.startValue); + }, + // @overide + cleanLeadingSpace : function(e) + { + return; } + });/* * Based on: * Ext JS Library 1.1.1 @@ -42106,7 +42126,7 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, { this.view.select(match); var sn = Roo.get(this.view.getSelectedNodes()[0]); sn.scrollIntoView(sn.dom.parentNode, false); - } + } /** * @cfg {Boolean} grow @@ -42241,7 +42261,7 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, // give fake names to child combo; this.combo.hiddenName = this.hiddenName ? (this.hiddenName+'-subcombo') : this.hiddenName; - this.combo.name = this.name? (this.name+'-subcombo') : this.name; + this.combo.name = this.name ? (this.name+'-subcombo') : this.name; this.combo = Roo.factory(this.combo, Roo.form); this.combo.onRender(ct, position); @@ -42362,6 +42382,7 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, { var valueField = this.combo.valueField; var displayField = this.combo.displayField; + if (this.items.indexOfKey(rec[valueField]) > -1) { //console.log("GOT " + rec.data.id); return; @@ -42393,7 +42414,6 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, this.items.each(function(f) { ar.push(f.data[idField]); - }); this.hiddenEl.dom.value = ar.join(','); this.validate(); @@ -42419,11 +42439,9 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField, }, setValue: function(v) // not a valid action - must use addItems.. { - - this.reset(); - - + this.reset(); + if (this.store.isLocal && (typeof(v) == 'string')) { // then we can use the store to find the values.. // comma seperated at present.. this needs to allow JSON based encoding.. @@ -43230,17 +43248,32 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { html = this.cleanHtml(html); // fix up the special chars.. normaly like back quotes in word... // however we do not want to do this with chinese.. - html = html.replace(/([\x80-\uffff])/g, function (a, b) { - var cc = b.charCodeAt(); - if ( + html = html.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u0080-\uFFFF]/g, function(match) { + + var cc = match.charCodeAt(); + + // Get the character value, handling surrogate pairs + if (match.length == 2) { + // It's a surrogate pair, calculate the Unicode code point + var high = match.charCodeAt(0) - 0xD800; + var low = match.charCodeAt(1) - 0xDC00; + cc = (high * 0x400) + low + 0x10000; + } else if ( (cc >= 0x4E00 && cc < 0xA000 ) || (cc >= 0x3400 && cc < 0x4E00 ) || (cc >= 0xf900 && cc < 0xfb00 ) ) { - return b; - } - return "&#"+cc+";" + return match; + } + + // No, use a numeric entity. Here we brazenly (and possibly mistakenly) + return "&#" + cc + ";"; + + }); + + + if(this.owner.fireEvent('beforesync', this, html) !== false){ this.el.dom.value = html; this.owner.fireEvent('sync', this, html); @@ -43920,6 +43953,11 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { var remove_keep_children= Roo.HtmlEditorCore.remove.indexOf(node.tagName.toLowerCase()) > -1; + // spans with no attributes - just remove them.. + if ((!node.attributes || !node.attributes.length) && lcname == 'span') { + remove_keep_children = true; + } + // remove as rendering on yahoo mailer is borked with this. // this will have to be flaged elsewhere - perhaps ablack=name... on the mailer.. @@ -43940,6 +43978,10 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { } if (!node.attributes || !node.attributes.length) { + + + + this.cleanUpChildren(node); return; } @@ -44036,11 +44078,11 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { if (a.name == 'class') { if (a.value.match(/^Mso/)) { - node.className = ''; + node.removeAttribute('class'); } if (a.value.match(/^body$/)) { - node.className = ''; + node.removeAttribute('class'); } continue; } @@ -44098,16 +44140,20 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.parentNode.removeChild(node); return; } - + //Roo.log(node.tagName); // remove - but keep children.. - if (node.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)) { + if (node.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|v:|font)/)) { + //Roo.log('-- removed'); while (node.childNodes.length) { var cn = node.childNodes[0]; node.removeChild(cn); node.parentNode.insertBefore(cn, node); + // move node to parent - and clean it.. + this.cleanWord(cn); } node.parentNode.removeChild(node); - this.iterateChildren(node, this.cleanWord); + /// no need to iterate chidlren = it's got none.. + //this.iterateChildren(node, this.cleanWord); return; } // clean styles @@ -45649,8 +45695,9 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype, { var c = Roo.get(editorcore.doc.body); c.select('[class]').each(function(s) { - s.dom.className = ''; + s.dom.removeAttribute('class'); }); + editorcore.cleanWord(); editorcore.syncValue(); }, tabIndex:-1 @@ -47308,7 +47355,7 @@ clientValidation Boolean Applies to submit only. Pass true to call fo return this; }, - + /** * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name * they are returned as an array. @@ -47323,6 +47370,17 @@ clientValidation Boolean Applies to submit only. Pass true to call fo }, this); } + // use formdata + if (typeof(FormData) != 'undefined' && asString !== true) { + var fd = (new FormData(this.el.dom)).entries(); + var ret = {}; + var ent = fd.next(); + while (!ent.done) { + ret[ent.value[0]] = ent.value[1]; // not sure how this will handle duplicates.. + ent = fd.next(); + }; + return ret; + } var fs = Roo.lib.Ajax.serializeForm(this.el.dom); @@ -52571,7 +52629,7 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * Collapses this region. * @param {Boolean} skipAnim (optional) true to collapse the element without animation (if animate is true) */ - collapse : function(skipAnim, skipCheck = false){ + collapse : function(skipAnim, skipCheck){ if(this.collapsed) { return; }