fix broken commit
[roojs1] / roojs-ui.js
index d80413f..74c0a88 100644 (file)
@@ -992,14 +992,14 @@ for(var i=0;i<B.length;i++){B[i].className="MsoListParagraph";}B=Array.from(A.ge
 i<B.length;i++){B[i].className="MsoListParagraph";}var C=Array.from(A.getElementsByTagName('h2'));for(var i=0;i<C.length;i++){if(C[i].hasAttribute('style')&&C[i].getAttribute('style').match(/mso-list:/)){C[i].className="MsoListParagraph";}}B=Array.from(A.getElementsByClassName('MsoNormal'));
 for(var i=0;i<B.length;i++){if(B[i].hasAttribute('style')&&B[i].getAttribute('style').match(/mso-list:/)){B[i].className="MsoListParagraph";}else{B[i].className="MsoNormalx";}}B=A.getElementsByClassName('MsoListParagraph');while(B.length){this.replaceDocBullet(B.item(0));
 }},replaceDocBullet:function(p){var ns=p,A=p.parentNode,B=A.ownerDocument,C=[];var D='ul';while(ns){if(ns.nodeType!=1){ns=ns.nextSibling;continue;}if(!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)){break;}var E=ns.getElementsByTagName('span');if(ns.hasAttribute('style')&&ns.getAttribute('style').match(/mso-list/)){C.push(ns);
-ns=ns.nextSibling;F=true;if(!E.length){continue;}var ff=E[0].style.fontFamily;if(!E[0].hasAttribute('style')&&E.length>1&&E[1].hasAttribute('style')){ff=E[1].style.fontFamily;}if(typeof(ff)!='undefined'&&!ff.match(/Symbol/)){D='ol';}continue;}var E=ns.getElementsByTagName('span');
-if(!E.length){break;}var F=false;for(var i=0;i<E.length;i++){if(E[i].hasAttribute('style')&&E[i].getAttribute('style').match(/mso-list/)){F=true;break;}}if(!F){break;}C.push(ns);ns=ns.nextSibling;}if(!C.length){ns.className="";return;}var ul=A.ownerDocument.createElement(D);
-A.insertBefore(ul,p);var G=0;var H=[ul];var I=false;var J={};max_margins=-1;C.forEach(function(n,K){var L=n.getElementsByTagName('span');if(!L.length){A.removeChild(n);return;}var M=1;var N={};for(var i=0;i<L.length;i++){N=this.styleToObject(L[i]);if(typeof(N['mso-list'])=='undefined'){continue;
-}if(D=='ol'){M=L[i].innerText.replace(/[^0-9]+]/g,'')*1;}L[i].parentNode.removeChild(L[i]);break;}N=this.styleToObject(n);if(typeof(N['mso-list'])=='undefined'){A.removeChild(n);return;}var O=N['margin-left'];if(typeof(J[O])=='undefined'){max_margins++;J[O]=max_margins;
-}nlvl=J[O];if(nlvl>G){var P=B.createElement(D);if(!I){I=B.createElement('li');H[G].appendChild(I);}I.appendChild(P);H[nlvl]=P;}G=nlvl;if(!H[nlvl].hasAttribute("start")&&D=="ol"){H[nlvl].setAttribute("start",M);}var Q=H[nlvl].appendChild(B.createElement('li'));
-I=Q;Q.innerHTML=n.innerHTML;A.removeChild(n);},this);},replaceImageTable:function(A){var B=Array.from(A.getElementsByTagName('img'));Roo.each(B,function(C){var td=C.parentNode;if(td.nodeName!='TD'){return;}var tr=td.parentNode;if(tr.nodeName!='TR'){return;
-}var D=tr.parentNode;if(D.nodeName!='TBODY'){return;}var E=D.parentNode;if(E.nodeName!='TABLE'){return;}if(E.getElementsByTagName('tr').length!=2){return;}if(E.getElementsByTagName('td').length!=3){return;}if(E.innerText.trim()!=''){return;}var p=E.parentNode;
-C.parentNode.removeChild(C);p.insertBefore(C,E);p.removeChild(E);});}});
+ns=ns.nextSibling;F=true;if(!E.length){continue;}var ff='';var se=E[0];for(var i=0;i<E.length;i++){se=E[i];if(se.hasAttribute('style')&&se.hasAttribute('style')&&se.style.fontFamily!=''){ff=se.style.fontFamily;break;}}if(typeof(ff)!='undefined'&&!ff.match(/(Symbol|Wingdings)/)&&"·o".indexOf(se.innerText.trim())<0){D='ol';
+}continue;}var E=ns.getElementsByTagName('span');if(!E.length){break;}var F=false;for(var i=0;i<E.length;i++){if(E[i].hasAttribute('style')&&E[i].getAttribute('style').match(/mso-list/)){F=true;break;}}if(!F){break;}C.push(ns);ns=ns.nextSibling;}if(!C.length){ns.className="";
+return;}var ul=A.ownerDocument.createElement(D);A.insertBefore(ul,p);var G=0;var H=[ul];var I=false;var J={};max_margins=-1;C.forEach(function(n,K){var L=n.getElementsByTagName('span');if(!L.length){A.removeChild(n);return;}var M=1;var N={};for(var i=0;i<L.length;
+i++){N=this.styleToObject(L[i]);if(typeof(N['mso-list'])=='undefined'){continue;}if(D=='ol'){M=L[i].innerText.replace(/[^0-9]+]/g,'')*1;}L[i].parentNode.removeChild(L[i]);break;}N=this.styleToObject(n);if(typeof(N['mso-list'])=='undefined'){A.removeChild(n);
+return;}var O=N['margin-left'];if(typeof(J[O])=='undefined'){max_margins++;J[O]=max_margins;}nlvl=J[O];if(nlvl>G){var P=B.createElement(D);if(!I){I=B.createElement('li');H[G].appendChild(I);}I.appendChild(P);H[nlvl]=P;}G=nlvl;if(!H[nlvl].hasAttribute("start")&&D=="ol"){H[nlvl].setAttribute("start",M);
+}var Q=H[nlvl].appendChild(B.createElement('li'));I=Q;Q.innerHTML=n.innerHTML;A.removeChild(n);},this);},replaceImageTable:function(A){var B=Array.from(A.getElementsByTagName('img'));Roo.each(B,function(C){var td=C.parentNode;if(td.nodeName!='TD'){return;
+}var tr=td.parentNode;if(tr.nodeName!='TR'){return;}var D=tr.parentNode;if(D.nodeName!='TBODY'){return;}var E=D.parentNode;if(E.nodeName!='TABLE'){return;}if(E.getElementsByTagName('tr').length!=2){return;}if(E.getElementsByTagName('td').length!=3){return;
+}if(E.innerText.trim()!=''){return;}var p=E.parentNode;C.parentNode.removeChild(C);p.insertBefore(C,E);p.removeChild(E);});}});
 // Roo/htmleditor/FilterStyleToTag.js
 Roo.htmleditor.FilterStyleToTag=function(A){this.tags={B:['fontWeight','bold'],I:['fontStyle','italic'],SUP:['verticalAlign','super'],SUB:['verticalAlign','sub']};Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterStyleToTag,Roo.htmleditor.Filter,{tag:true,tags:false,replaceTag:function(A){if(A.getAttribute("style")===null){return true;
 }var B=[];for(var k in this.tags){if(A.style[this.tags[k][0]]==this.tags[k][1]){B.push(k);A.style.removeProperty(this.tags[k][0]);}}if(!B.length){return true;}var cn=Array.from(A.childNodes);var nn=A;Roo.each(B,function(t){var nc=A.ownerDocument.createElement(t);
@@ -1163,7 +1163,7 @@ while((lc.nodeType==3&&lc.nodeValue=='')||lc.id=='gtx-trans'){lc=lc.previousSibl
 var A=this.win.getSelection();A.removeAllRanges();A.addRange(range);}}this.fireEditorEvent(e);this.syncValue();},fireEditorEvent:function(e){this.owner.fireEvent('editorevent',this,e);},insertTag:function(tg){if(tg.toLowerCase()=='span'||tg.toLowerCase()=='code'||tg.toLowerCase()=='sup'||tg.toLowerCase()=='sub'){range=this.createRange(this.getSelection());
 var A=this.doc.createElement(tg.toLowerCase());A.appendChild(range.extractContents());range.insertNode(A);return;}this.execCmd("formatblock",tg);this.undoManager.addEvent();},insertText:function(A){var B=this.createRange();B.deleteContents();B.insertNode(this.doc.createTextNode(A));
 this.undoManager.addEvent();},relayCmd:function(A,B){switch(A){case 'justifyleft':case 'justifyright':case 'justifycenter':var n=this.getParentElement();var td=n.closest('td');if(td){var bl=Roo.htmleditor.Block.factory(td);bl.textAlign=A.replace('justify','');
-bl.updateElement();this.owner.fireEvent('editorevent',this);return;}this.execCmd('styleWithCSS',true);break;case 'bold':case 'italic':this.execCmd('styleWithCSS',false);break;default:break;}this.win.focus();this.execCmd(A,B);this.owner.fireEvent('editorevent',this);
+bl.updateElement();this.owner.fireEvent('editorevent',this);return;}this.execCmd('styleWithCSS',true);break;case 'bold':case 'italic':case 'underline':this.execCmd('styleWithCSS',false);break;default:break;}this.win.focus();this.execCmd(A,B);this.owner.fireEvent('editorevent',this);
 this.owner.deferFocus();},execCmd:function(A,B){this.doc.execCommand(A,false,B===undefined?null:B);this.syncValue();},insertAtCursor:function(A){if(!this.activated){return;}if(Roo.isGecko||Roo.isOpera||Roo.isSafari){this.win.focus();var B,C;var D=this.win;
 if(D.getSelection&&D.getSelection().getRangeAt){this.createRange(this.getSelection()).deleteContents();B=D.getSelection().getRangeAt(0);C=typeof(A)=='string'?B.createContextualFragment(A):A;B.insertNode(C);B=B.cloneRange();B.collapse(false);D.getSelection().removeAllRanges();
 D.getSelection().addRange(B);}else if(D.document.selection&&D.document.selection.createRange){var E=typeof(A)=='string'?A:A.outerHTML;D.document.selection.createRange().pasteHTML(E);}else{var E=typeof(A)=='string'?A:A.outerHTML;this.execCmd('InsertHTML',E);