Roo/HtmlEditorCore.js
authorleon <leon@roojs.com>
Mon, 14 Aug 2023 04:07:05 +0000 (12:07 +0800)
committerleon <leon@roojs.com>
Mon, 14 Aug 2023 04:07:05 +0000 (12:07 +0800)
roojs-core.js
roojs-core-debug.js
roojs-ui.js
roojs-ui-debug.js
roojs-debug.js
roojs-all.js

Roo/HtmlEditorCore.js
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 004c7ea..0b07db9 100644 (file)
@@ -482,16 +482,15 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             }
             if (this.autoClean) {
                 new Roo.htmleditor.FilterParagraph({node : this.doc.body}); // paragraphs
+                Roo.log('FILTER PARA');
+                Roo.log(this.doc.body);
                 new Roo.htmleditor.FilterSpan({node : this.doc.body}); // empty spans
+                Roo.log('FILTER SPAN');
+                Roo.log(this.doc.body);
             }
-            Roo.log('AUTO CLEAN');
-            Roo.log(this.doc.body);
             if (this.enableBlocks) {
                 Roo.htmleditor.Block.initAll(this.doc.body);
             }
-
-            Roo.log('ENABLE BLOCKS');
-            Roo.log(this.doc.body);
             
             this.updateLanguage();
             
index f4cf4fb..8bb0c83 100644 (file)
@@ -2087,8 +2087,8 @@ if(C.length>0){var rm=C.item(0).parentNode;rm.parentNode.removeChild(rm);}if(thi
 );var E=new Roo.htmleditor.TidySerializer({inner:true});D=E.serialize(B);}if(Roo.isSafari){var bs=bd.getAttribute('style');var m=bs?bs.match(/text-align:(.*?);/i):false;if(m&&m[1]){D='<div style="'+m[0]+'">'+D+'</div>';}}D=this.cleanHtml(D);D=D.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u0080-\uFFFF]/g,function(F){var cc=F.charCodeAt();
 if(F.length==2){var G=F.charCodeAt(0)-0xD800;var H=F.charCodeAt(1)-0xDC00;cc=(G*0x400)+H+0x10000;}else if((cc>=0x4E00&&cc<0xA000)||(cc>=0x3400&&cc<0x4E00)||(cc>=0xf900&&cc<0xfb00)){return F;}return "&#"+cc+";";});if(this.owner.fireEvent('beforesync',this,D)!==false){this.el.dom.value=D;
 this.owner.fireEvent('sync',this,D);}}},pushValue:function(){Roo.log("HtmlEditorCore:pushValue (TEXT->EDITOR)");if(this.initialized){var v=this.el.dom.value.trim();Roo.log(v);if(this.owner.fireEvent('beforepush',this,v)!==false){var d=(this.doc.body||this.doc.documentElement);
-d.innerHTML=v;this.el.dom.value=d.innerHTML;this.owner.fireEvent('push',this,v);}if(this.autoClean){new Roo.htmleditor.FilterParagraph({node:this.doc.body});new Roo.htmleditor.FilterSpan({node:this.doc.body});}Roo.log('AUTO CLEAN');Roo.log(this.doc.body);
-if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}Roo.log('ENABLE BLOCKS');Roo.log(this.doc.body);this.updateLanguage();var lc=this.doc.body.lastChild;if(lc&&lc.nodeType==1&&lc.getAttribute("contenteditable")=="false"){this.doc.body.appendChild(this.doc.createElement('br'));
+d.innerHTML=v;this.el.dom.value=d.innerHTML;this.owner.fireEvent('push',this,v);}if(this.autoClean){new Roo.htmleditor.FilterParagraph({node:this.doc.body});Roo.log('FILTER PARA');Roo.log(this.doc.body);new Roo.htmleditor.FilterSpan({node:this.doc.body});
+Roo.log('FILTER SPAN');Roo.log(this.doc.body);}if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}this.updateLanguage();var lc=this.doc.body.lastChild;if(lc&&lc.nodeType==1&&lc.getAttribute("contenteditable")=="false"){this.doc.body.appendChild(this.doc.createElement('br'));
 }}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();}else{this.el.focus();}},assignDocWin:function(){var A=this.iframe;if(Roo.isIE){this.doc=A.contentWindow.document;this.win=A.contentWindow;
 }else{if(!Roo.get(this.frameId)&&!A.contentDocument){return;}this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);this.win=(A.contentWindow||Roo.get(this.frameId).dom.contentWindow);}},initEditor:function(){this.assignDocWin();this.doc.designMode="on";
 this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var A=(this.doc.body||this.doc.documentElement);A.bgProperties='fixed';A.setAttribute("translate","no");Roo.EventManager.on(this.doc,{'mouseup':this.onEditorEvent,'dblclick':this.onEditorEvent,'click':this.onEditorEvent,'keyup':this.onEditorEvent,buffer:100,scope:this}
index 12a35de..4b032e9 100644 (file)
@@ -50434,16 +50434,15 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             }
             if (this.autoClean) {
                 new Roo.htmleditor.FilterParagraph({node : this.doc.body}); // paragraphs
+                Roo.log('FILTER PARA');
+                Roo.log(this.doc.body);
                 new Roo.htmleditor.FilterSpan({node : this.doc.body}); // empty spans
+                Roo.log('FILTER SPAN');
+                Roo.log(this.doc.body);
             }
-            Roo.log('AUTO CLEAN');
-            Roo.log(this.doc.body);
             if (this.enableBlocks) {
                 Roo.htmleditor.Block.initAll(this.doc.body);
             }
-
-            Roo.log('ENABLE BLOCKS');
-            Roo.log(this.doc.body);
             
             this.updateLanguage();
             
index 764d288..5a79869 100644 (file)
@@ -25932,16 +25932,15 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             }
             if (this.autoClean) {
                 new Roo.htmleditor.FilterParagraph({node : this.doc.body}); // paragraphs
+                Roo.log('FILTER PARA');
+                Roo.log(this.doc.body);
                 new Roo.htmleditor.FilterSpan({node : this.doc.body}); // empty spans
+                Roo.log('FILTER SPAN');
+                Roo.log(this.doc.body);
             }
-            Roo.log('AUTO CLEAN');
-            Roo.log(this.doc.body);
             if (this.enableBlocks) {
                 Roo.htmleditor.Block.initAll(this.doc.body);
             }
-
-            Roo.log('ENABLE BLOCKS');
-            Roo.log(this.doc.body);
             
             this.updateLanguage();
             
index 83d8bff..b42b0c6 100644 (file)
@@ -1140,8 +1140,8 @@ if(C.length>0){var rm=C.item(0).parentNode;rm.parentNode.removeChild(rm);}if(thi
 );var E=new Roo.htmleditor.TidySerializer({inner:true});D=E.serialize(B);}if(Roo.isSafari){var bs=bd.getAttribute('style');var m=bs?bs.match(/text-align:(.*?);/i):false;if(m&&m[1]){D='<div style="'+m[0]+'">'+D+'</div>';}}D=this.cleanHtml(D);D=D.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u0080-\uFFFF]/g,function(F){var cc=F.charCodeAt();
 if(F.length==2){var G=F.charCodeAt(0)-0xD800;var H=F.charCodeAt(1)-0xDC00;cc=(G*0x400)+H+0x10000;}else if((cc>=0x4E00&&cc<0xA000)||(cc>=0x3400&&cc<0x4E00)||(cc>=0xf900&&cc<0xfb00)){return F;}return "&#"+cc+";";});if(this.owner.fireEvent('beforesync',this,D)!==false){this.el.dom.value=D;
 this.owner.fireEvent('sync',this,D);}}},pushValue:function(){Roo.log("HtmlEditorCore:pushValue (TEXT->EDITOR)");if(this.initialized){var v=this.el.dom.value.trim();Roo.log(v);if(this.owner.fireEvent('beforepush',this,v)!==false){var d=(this.doc.body||this.doc.documentElement);
-d.innerHTML=v;this.el.dom.value=d.innerHTML;this.owner.fireEvent('push',this,v);}if(this.autoClean){new Roo.htmleditor.FilterParagraph({node:this.doc.body});new Roo.htmleditor.FilterSpan({node:this.doc.body});}Roo.log('AUTO CLEAN');Roo.log(this.doc.body);
-if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}Roo.log('ENABLE BLOCKS');Roo.log(this.doc.body);this.updateLanguage();var lc=this.doc.body.lastChild;if(lc&&lc.nodeType==1&&lc.getAttribute("contenteditable")=="false"){this.doc.body.appendChild(this.doc.createElement('br'));
+d.innerHTML=v;this.el.dom.value=d.innerHTML;this.owner.fireEvent('push',this,v);}if(this.autoClean){new Roo.htmleditor.FilterParagraph({node:this.doc.body});Roo.log('FILTER PARA');Roo.log(this.doc.body);new Roo.htmleditor.FilterSpan({node:this.doc.body});
+Roo.log('FILTER SPAN');Roo.log(this.doc.body);}if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}this.updateLanguage();var lc=this.doc.body.lastChild;if(lc&&lc.nodeType==1&&lc.getAttribute("contenteditable")=="false"){this.doc.body.appendChild(this.doc.createElement('br'));
 }}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();}else{this.el.focus();}},assignDocWin:function(){var A=this.iframe;if(Roo.isIE){this.doc=A.contentWindow.document;this.win=A.contentWindow;
 }else{if(!Roo.get(this.frameId)&&!A.contentDocument){return;}this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);this.win=(A.contentWindow||Roo.get(this.frameId).dom.contentWindow);}},initEditor:function(){this.assignDocWin();this.doc.designMode="on";
 this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var A=(this.doc.body||this.doc.documentElement);A.bgProperties='fixed';A.setAttribute("translate","no");Roo.EventManager.on(this.doc,{'mouseup':this.onEditorEvent,'dblclick':this.onEditorEvent,'click':this.onEditorEvent,'keyup':this.onEditorEvent,buffer:100,scope:this}