From bb4f20285cb0ce281099e1db5cb76e60175de50f Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 20 Apr 2022 13:56:16 +0800 Subject: [PATCH] fix word filter on html editor --- Roo/htmleditor/FilterWord.js | 2 +- docs/src/Roo_data_MemoryProxy.js.html | 7 ++++--- docs/src/Roo_htmleditor_FilterWord.js.html | 2 +- roojs-all.js | 6 +++--- roojs-bootstrap-debug.js | 7 ++++--- roojs-bootstrap.js | 4 ++-- roojs-debug.js | 9 +++++---- roojs-ui-debug.js | 9 +++++---- roojs-ui.js | 6 +++--- 9 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Roo/htmleditor/FilterWord.js b/Roo/htmleditor/FilterWord.js index 682d2e26b4..3cb8df628a 100644 --- a/Roo/htmleditor/FilterWord.js +++ b/Roo/htmleditor/FilterWord.js @@ -212,7 +212,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } var nlvl = (style['mso-list'].split(' ')[1].replace(/level/,'') *1) - 1; - if (nlvl > lvl) { + if (nlvl > lvl && last_li) { //new indent var nul = doc.createElement('ul'); // what about number lists... last_li.appendChild(nul); diff --git a/docs/src/Roo_data_MemoryProxy.js.html b/docs/src/Roo_data_MemoryProxy.js.html index 14d027152c..436738aecd 100644 --- a/docs/src/Roo_data_MemoryProxy.js.html +++ b/docs/src/Roo_data_MemoryProxy.js.html @@ -16,9 +16,10 @@ * @constructor * @param {Object} config A config object containing the objects needed for the Store to access data, */ -Roo.data.MemoryProxy = function(data){ - if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') { - data = data.data; +Roo.data.MemoryProxy = function(config){ + var data = config; + if (typeof(config) != 'undefined' && typeof(config.data) != 'undefined') { + data = config.data; } Roo.data.MemoryProxy.superclass.constructor.call(this); this.data = data; diff --git a/docs/src/Roo_htmleditor_FilterWord.js.html b/docs/src/Roo_htmleditor_FilterWord.js.html index 39c0cf9e51..5336910c92 100644 --- a/docs/src/Roo_htmleditor_FilterWord.js.html +++ b/docs/src/Roo_htmleditor_FilterWord.js.html @@ -212,7 +212,7 @@ } var nlvl = (style['mso-list'].split(' ')[1].replace(/level/,'') *1) - 1; - if (nlvl > lvl) { + if (nlvl > lvl && last_li) { //new indent var nul = doc.createElement('ul'); // what about number lists... last_li.appendChild(nul); diff --git a/roojs-all.js b/roojs-all.js index 3efc0e9642..307a86afb7 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -999,8 +999,8 @@ break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break; // Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); // Roo/data/MemoryProxy.js -Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F; -try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); +Roo.data.MemoryProxy=function(A){var B=A;if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){B=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=B;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{} +;var F;try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); @@ -1933,7 +1933,7 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0]]=kv[1];});return C;},replaceDocBullets:function(A){var B=A.getElementsByClassName('ql-indent-1');while(B.length){this.replaceDocBullet(B.item(0));}var 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;}C.push(ns); ns=ns.nextSibling;}var ul=A.ownerDocument.createElement('ul');A.insertBefore(ul,p);var D=0;var E=[ul];var F=false;C.forEach(function(n){var G=n.getElementsByTagName('span');if(!G.length){A.removeChild(n);return;}var H={};for(var i=0;iD){var J=B.createElement('ul'); +if(typeof(H['mso-list'])=='undefined'){continue;}G[i].parentNode.removeChild(G[i]);break;}H=this.styleToObject(n);if(typeof(H['mso-list'])=='undefined'){A.removeChild(n);return;}var I=(H['mso-list'].split(' ')[1].replace(/level/,'')*1)-1;if(I>D&&F){var J=B.createElement('ul'); F.appendChild(J);E[I]=J;}D=I;var K=E[I].appendChild(B.createElement('li'));F=K;K.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; diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index ff7d054e33..c5e35d3fe0 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -16092,9 +16092,10 @@ Roo.extend(Roo.data.DataProxy, Roo.util.Observable); * @constructor * @param {Object} config A config object containing the objects needed for the Store to access data, */ -Roo.data.MemoryProxy = function(data){ - if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') { - data = data.data; +Roo.data.MemoryProxy = function(config){ + var data = config; + if (typeof(config) != 'undefined' && typeof(config.data) != 'undefined') { + data = config.data; } Roo.data.MemoryProxy.superclass.constructor.call(this); this.data = data; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 7b108ea173..0dae4c7970 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -675,8 +675,8 @@ break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break; // Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); // Roo/data/MemoryProxy.js -Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F; -try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); +Roo.data.MemoryProxy=function(A){var B=A;if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){B=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=B;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{} +;var F;try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); diff --git a/roojs-debug.js b/roojs-debug.js index 7935bec014..b72198f2df 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -25892,9 +25892,10 @@ Roo.extend(Roo.data.DataProxy, Roo.util.Observable); * @constructor * @param {Object} config A config object containing the objects needed for the Store to access data, */ -Roo.data.MemoryProxy = function(data){ - if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') { - data = data.data; +Roo.data.MemoryProxy = function(config){ + var data = config; + if (typeof(config) != 'undefined' && typeof(config.data) != 'undefined') { + data = config.data; } Roo.data.MemoryProxy.superclass.constructor.call(this); this.data = data; @@ -46276,7 +46277,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } var nlvl = (style['mso-list'].split(' ')[1].replace(/level/,'') *1) - 1; - if (nlvl > lvl) { + if (nlvl > lvl && last_li) { //new indent var nul = doc.createElement('ul'); // what about number lists... last_li.appendChild(nul); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 9ad7d68e98..cb4aab90a6 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -1400,9 +1400,10 @@ Roo.extend(Roo.data.DataProxy, Roo.util.Observable); * @constructor * @param {Object} config A config object containing the objects needed for the Store to access data, */ -Roo.data.MemoryProxy = function(data){ - if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') { - data = data.data; +Roo.data.MemoryProxy = function(config){ + var data = config; + if (typeof(config) != 'undefined' && typeof(config.data) != 'undefined') { + data = config.data; } Roo.data.MemoryProxy.superclass.constructor.call(this); this.data = data; @@ -21784,7 +21785,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } var nlvl = (style['mso-list'].split(' ')[1].replace(/level/,'') *1) - 1; - if (nlvl > lvl) { + if (nlvl > lvl && last_li) { //new indent var nul = doc.createElement('ul'); // what about number lists... last_li.appendChild(nul); diff --git a/roojs-ui.js b/roojs-ui.js index f400d5b442..d319e31ea6 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -53,8 +53,8 @@ break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break; // Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); // Roo/data/MemoryProxy.js -Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F; -try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); +Roo.data.MemoryProxy=function(A){var B=A;if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){B=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=B;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{} +;var F;try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); @@ -987,7 +987,7 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0]]=kv[1];});return C;},replaceDocBullets:function(A){var B=A.getElementsByClassName('ql-indent-1');while(B.length){this.replaceDocBullet(B.item(0));}var 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;}C.push(ns); ns=ns.nextSibling;}var ul=A.ownerDocument.createElement('ul');A.insertBefore(ul,p);var D=0;var E=[ul];var F=false;C.forEach(function(n){var G=n.getElementsByTagName('span');if(!G.length){A.removeChild(n);return;}var H={};for(var i=0;iD){var J=B.createElement('ul'); +if(typeof(H['mso-list'])=='undefined'){continue;}G[i].parentNode.removeChild(G[i]);break;}H=this.styleToObject(n);if(typeof(H['mso-list'])=='undefined'){A.removeChild(n);return;}var I=(H['mso-list'].split(' ')[1].replace(/level/,'')*1)-1;if(I>D&&F){var J=B.createElement('ul'); F.appendChild(J);E[I]=J;}D=I;var K=E[I].appendChild(B.createElement('li'));F=K;K.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; -- 2.39.2