HtmlEditor - fire HTML cleanup on loading, and fix compress issues
[roojs1] / Roo / form / HtmlEditor.js
index c178596..f72d2d8 100644 (file)
@@ -345,6 +345,7 @@ Roo.form.HtmlEditor = Roo.extend(Roo.form.Field, {
     syncValue : function(){
         if(this.initialized){
             var bd = (this.doc.body || this.doc.documentElement);
+            this.cleanUpPaste();
             var html = bd.innerHTML;
             if(Roo.isSafari){
                 var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!
@@ -371,8 +372,12 @@ Roo.form.HtmlEditor = Roo.extend(Roo.form.Field, {
             if(v.length < 1){
                 v = '&#160;';
             }
+            
             if(this.fireEvent('beforepush', this, v) !== false){
-                (this.doc.body || this.doc.documentElement).innerHTML = v;
+                var d = (this.doc.body || this.doc.documentElement);
+                d.innerHTML = v;
+                this.cleanUpPaste();
+                this.el.dom.value = d.innerHTML;
                 this.fireEvent('push', this, v);
             }
         }
@@ -867,7 +872,7 @@ Roo.form.HtmlEditor = Roo.extend(Roo.form.Field, {
     {
         // cleans up the whole document..
       //  console.log('cleanuppaste');
-        this.cleanUpChildren(this.doc.body)
+        this.cleanUpChildren(this.doc.body);
         
         
     },