Fix #7284 - more issues with bullet point detection
[roojs1] / roojs-all.js
index 9688489..9608c7f 100644 (file)
@@ -1931,12 +1931,13 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac
 }C.push(F);});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return;
 }var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}return true;},styleToObject:function(A){var B=(A.getAttribute("style")||'').split(";");
 var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0].trim()]=kv[1];});return C;},replaceDocBullets:function(A){var B=A.getElementsByClassName('MsoListParagraphCxSpFirst');for(var i=0;i<B.length;i++){B.item(i).className="MsoListParagraph";
-}var C=A.getElementsByTagName('h2');for(var i=0;i<C.length;i++){if(C.item(i).getAttribute('style').match(/mso-list:/)){C.item(i).className="MsoListParagraph";}}B=A.getElementsByClassName('ql-indent-1');while(B.length){this.replaceDocBullet(B.item(0));}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=[];while(ns){if(ns.nodeType!=1){ns=ns.nextSibling;continue;}if(!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)){break;}var D=ns.getElementsByTagName('span');
-if(!D.length){break;}var E=false;for(var i=0;i<D.length;i++){if(D[i].getAttribute('style').match(/mso-list/)){E=true;break;}}if(!E){break;}C.push(ns);ns=ns.nextSibling;}if(!C.length){ns.className="";return;}var ul=A.ownerDocument.createElement('ul');A.insertBefore(ul,p);
-var F=0;var G=[ul];var H=false;C.forEach(function(n,I){var J=n.getElementsByTagName('span');if(!J.length){A.removeChild(n);return;}var K={};for(var i=0;i<J.length;i++){K=this.styleToObject(J[i]);if(typeof(K['mso-list'])=='undefined'){continue;}J[i].parentNode.removeChild(J[i]);
-break;}K=this.styleToObject(n);if(typeof(K['mso-list'])=='undefined'){A.removeChild(n);return;}var L=(K['mso-list'].split(' ')[1].replace(/level/,'')*1)-1;if(L>F){var M=B.createElement('ul');if(!H){H=B.createElement('li');G[F].appendChild(H);}H.appendChild(M);
-G[L]=M;}F=L;var N=G[L].appendChild(B.createElement('li'));H=N;N.innerHTML=n.innerHTML;A.removeChild(n);},this);}});
+}var C=A.getElementsByTagName('h2');for(var i=0;i<C.length;i++){if(C.item(i).hasAttribute('style')&&C.item(i).getAttribute('style').match(/mso-list:/)){C.item(i).className="MsoListParagraph";}}B=A.getElementsByClassName('MsoNormal');while(B.length){if(B.item(0).hasAttribute('style')&&B.item(0).getAttribute('style').match(/mso-list:/)){B.item(0).className="MsoListParagraph";
+}else{B.item(0).className="MsoNormalx";}}B=A.getElementsByClassName('ql-indent-1');while(B.length){this.replaceDocBullet(B.item(0));}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=[];
+while(ns){if(ns.nodeType!=1){ns=ns.nextSibling;continue;}if(!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)){break;}if(ns.getAttribute('style').match(/mso-list/)){C.push(ns);ns=ns.nextSibling;E=true;continue;}var D=ns.getElementsByTagName('span');if(!D.length){break;
+}var E=false;for(var i=0;i<D.length;i++){if(D[i].getAttribute('style').match(/mso-list/)){E=true;break;}}if(!E){break;}C.push(ns);ns=ns.nextSibling;}if(!C.length){ns.className="";return;}var ul=A.ownerDocument.createElement('ul');A.insertBefore(ul,p);var F=0;
+var G=[ul];var H=false;var I={};max_margins=-1;C.forEach(function(n,J){var K=n.getElementsByTagName('span');if(!K.length){A.removeChild(n);return;}var L={};for(var i=0;i<K.length;i++){L=this.styleToObject(K[i]);if(typeof(L['mso-list'])=='undefined'){continue;
+}K[i].parentNode.removeChild(K[i]);break;}L=this.styleToObject(n);if(typeof(L['mso-list'])=='undefined'){A.removeChild(n);return;}var M=L['margin-left'];if(typeof(I[M])=='undefined'){max_margins++;I[M]=max_margins;}nlvl=I[M];if(nlvl>F){var N=B.createElement('ul');
+if(!H){H=B.createElement('li');G[F].appendChild(H);}H.appendChild(N);G[nlvl]=N;}F=nlvl;var O=G[nlvl].appendChild(B.createElement('li'));H=O;O.innerHTML=n.innerHTML;A.removeChild(n);},this);}});
 // 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);