X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-ui-debug.js;h=8334d5b873ea0ea6256ca42f04ff461e10117c92;hb=ff355e12aa44d689f8536251642f2963c7abbf1e;hp=b15eda6e234d630a2b06186944e7c67aa4039245;hpb=1f33636e992f765ab9a406da9699956cea819bf8;p=roojs1 diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index b15eda6e23..8334d5b873 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -20526,7 +20526,9 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field, { this.fireEvent('check', this, state); } this.inSetChecked = true; - this.el.dom.value = state ? this.inputValue : this.valueOff; + + this.el.dom.value = state ? this.inputValue : this.valueOff; + this.inSetChecked = false; }, @@ -20617,9 +20619,49 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, { this.el.dom.checked = 'checked' ; } + }, + /** + * Sets the checked state of the checkbox. + * On is always based on a string comparison between inputValue and the param. + * @param {Boolean/String} value - the value to set + * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event. + */ + setValue : function(v,suppressEvent){ + + + //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on'); + //if(this.el && this.el.dom){ + // this.el.dom.checked = this.checked; + // this.el.dom.defaultChecked = this.checked; + //} + this.setChecked(String(v) === String(this.inputValue), suppressEvent); + + this.el.dom.form[this.name].value = v; + + //this.fireEvent("check", this, this.checked); + }, + // private.. + setChecked : function(state,suppressEvent) + { + + if(this.wrap){ + this.wrap[state ? 'addClass' : 'removeClass']('x-menu-item-checked'); + } + this.checked = state; + if(suppressEvent !== true){ + this.fireEvent('check', this, state); + } + + + + + }, + reset : function(){ + // this.setValue(this.resetValue); + //this.originalValue = this.getValue(); + this.clearInvalid(); } - });Roo.rtf = {}; // namespace Roo.rtf.Hex = function(hex) { @@ -21770,32 +21812,47 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, replaceDocBullets : function(doc) { // this is a bit odd - but it appears some indents use ql-indent-1 - //Roo.log(doc.innerHTML); + //Roo.log(doc.innerHTML); + + var listpara = Array.from(doc.getElementsByClassName('MsoListParagraphCxSpFirst')); + for( var i = 0; i < listpara.length; i ++) { + listpara[i].className = "MsoListParagraph"; + } - var listpara = doc.getElementsByClassName('MsoListParagraphCxSpFirst'); + listpara = Array.from(doc.getElementsByClassName('MsoListParagraphCxSpMiddle')); for( var i = 0; i < listpara.length; i ++) { - listpara.item(i).className = "MsoListParagraph"; + listpara[i].className = "MsoListParagraph"; } + listpara = Array.from(doc.getElementsByClassName('MsoListParagraphCxSpLast')); + for( var i = 0; i < listpara.length; i ++) { + listpara[i].className = "MsoListParagraph"; + } + listpara = Array.from(doc.getElementsByClassName('ql-indent-1')); + for( var i = 0; i < listpara.length; i ++) { + listpara[i].className = "MsoListParagraph"; + } + // this is a bit hacky - we had one word document where h2 had a miso-list attribute. - var htwo = doc.getElementsByTagName('h2'); + var htwo = Array.from(doc.getElementsByTagName('h2')); for( var i = 0; i < htwo.length; i ++) { - if (htwo.item(i).hasAttribute('style') && htwo.item(i).getAttribute('style').match(/mso-list:/)) { - htwo.item(i).className = "MsoListParagraph"; + if (htwo[i].hasAttribute('style') && htwo[i].getAttribute('style').match(/mso-list:/)) { + htwo[i].className = "MsoListParagraph"; } } - listpara = doc.getElementsByClassName('MsoNormal'); - while(listpara.length) { - if (listpara.item(0).hasAttribute('style') && listpara.item(0).getAttribute('style').match(/mso-list:/)) { - listpara.item(0).className = "MsoListParagraph"; + listpara = Array.from(doc.getElementsByClassName('MsoNormal')); + for( var i = 0; i < listpara.length; i ++) { + if (listpara[i].hasAttribute('style') && listpara[i].getAttribute('style').match(/mso-list:/)) { + listpara[i].className = "MsoListParagraph"; } else { - listpara.item(0).className = "MsoNormalx"; + listpara[i].className = "MsoNormalx"; } } - listpara = doc.getElementsByClassName('ql-indent-1'); - while(listpara.length) { - this.replaceDocBullet(listpara.item(0)); - } + listpara = doc.getElementsByClassName('MsoListParagraph'); + // Roo.log(doc.innerHTML); + + + while(listpara.length) { this.replaceDocBullet(listpara.item(0)); @@ -21813,7 +21870,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, doc = parent.ownerDocument, items = []; - + var listtype = 'ul'; while (ns) { if (ns.nodeType != 1) { ns = ns.nextSibling; @@ -21822,10 +21879,18 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, if (!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)) { break; } + var spans = ns.getElementsByTagName('span'); if (ns.hasAttribute('style') && ns.getAttribute('style').match(/mso-list/)) { items.push(ns); ns = ns.nextSibling; has_list = true; + if (spans.length && spans[0].hasAttribute('style')) { + var style = this.styleToObject(spans[0]); + if (typeof(style['font-family']) != 'undefined' && !style['font-family'].match(/Symbol/)) { + listtype = 'ol'; + } + } + continue; } var spans = ns.getElementsByTagName('span'); @@ -21852,7 +21917,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, return; } - var ul = parent.ownerDocument.createElement('ul'); // what about number lists... + var ul = parent.ownerDocument.createElement(listtype); // what about number lists... parent.insertBefore(ul, p); var lvl = 0; var stack = [ ul ]; @@ -21875,7 +21940,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } - + var num = 1; var style = {}; for(var i = 0; i < spans.length; i++) { @@ -21883,7 +21948,9 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, if (typeof(style['mso-list']) == 'undefined') { continue; } - + if (listtype == 'ol') { + num = spans[i].innerText.replace(/[^0-9]+]/g,'') * 1; + } spans[i].parentNode.removeChild(spans[i]); // remove the fake bullet. break; } @@ -21906,7 +21973,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, if (nlvl > lvl) { //new indent - var nul = doc.createElement('ul'); // what about number lists... + var nul = doc.createElement(listtype); // what about number lists... if (!last_li) { last_li = doc.createElement('li'); stack[lvl].appendChild(last_li); @@ -21917,6 +21984,11 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } lvl = nlvl; + // not starting at 1.. + if (!stack[nlvl].hasAttribute("start") && listtype == "ol") { + stack[nlvl].setAttribute("start", num); + } + var nli = stack[nlvl].appendChild(doc.createElement('li')); last_li = nli; nli.innerHTML = n.innerHTML; @@ -24915,6 +24987,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { this.colspan = Math.max(1,1*node.getAttribute('colspan')); this.rowspan = Math.max(1,1*node.getAttribute('rowspan')); this.html = node.innerHTML; + if (node.style.textAlign != '') { + this.textAlign = node.style.textAlign; + } }, @@ -25668,11 +25743,42 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { if (this.enableBlocks) { new Roo.htmleditor.FilterBlock({ node : div }); } + + var html = div.innerHTML; + //?? tidy? - var tidy = new Roo.htmleditor.TidySerializer({ - inner: true - }); - var html = tidy.serialize(div); + if (this.autoClean) { + + new Roo.htmleditor.FilterAttributes({ + node : div, + attrib_white : [ + 'href', + 'src', + 'name', + 'align', + 'colspan', + 'rowspan', + 'data-display', + 'data-width', + 'start' , + 'style', + // youtube embed. + 'class', + 'allowfullscreen', + 'frameborder', + 'width', + 'height', + 'alt' + ], + attrib_clean : ['href', 'src' ] + }); + + var tidy = new Roo.htmleditor.TidySerializer({ + inner: true + }); + html = tidy.serialize(div); + + } if(Roo.isSafari){ @@ -25925,7 +26031,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display', 'data-width'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display', 'data-width', 'start'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); @@ -29727,6 +29833,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo for(id in values){ if(typeof values[id] != 'function' && (field = this.findField(id))){ + + + if (field.setFromData && field.valueField && field.displayField && @@ -29741,6 +29850,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name]; field.setFromData(sd); + } else if (field.inputType && field.inputType == 'radio') { + + field.setValue(values[id]); } else { field.setValue(values[id]); } @@ -29766,7 +29878,7 @@ clientValidation Boolean Applies to submit only. Pass true to call fo /** * 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. - * @param {Boolean} asString + * @param {Boolean} asString (def) * @return {Object} */ getValues : function(asString) @@ -30846,7 +30958,13 @@ Roo.extend(Roo.form.Action.Submit, Roo.form.Action, { } var ret = false; try { - ret = Roo.decode(response.responseText); + var rt = response.responseText; + if (rt.match(/^\