Roo/form/HtmlEditor/ToolbarContext.js
authorAlan Knowles <alan@roojs.com>
Fri, 13 Apr 2012 07:01:01 +0000 (15:01 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 13 Apr 2012 07:01:01 +0000 (15:01 +0800)
Roo/form/HtmlEditor/ToolbarContext.js

index d329b33..51ae20d 100644 (file)
@@ -346,27 +346,31 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             }
             
             // update styles
-            var st = this.tb.fields.item(0);
-            st.store.removeAll();
-            var cn = sel.className.split(/\s+/);
-            
-            var avs = [];
-            if (this.styles['*']) {
+            if (this.styles) { 
+                var st = this.tb.fields.item(0);
+                if (st.store) {
+                    st.store.removeAll();
+                }
                 
-                Roo.each(this.styles['*'], function(v) {
-                    avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
-                });
-            }
-            if (this.styles[tn]) { 
-                Roo.each(this.styles[tn], function(v) {
-                    avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
-                });
+                var cn = sel.className.split(/\s+/);
+                
+                var avs = [];
+                if (this.styles['*']) {
+                    
+                    Roo.each(this.styles['*'], function(v) {
+                        avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
+                    });
+                }
+                if (this.styles[tn]) { 
+                    Roo.each(this.styles[tn], function(v) {
+                        avs.push( [ v , cn.indexOf(v) > -1 ? 1 : 0 ] );         
+                    });
+                }
+                
+                st.store.loadData(avs);
+                st.collapse();
+                st.setValue(cn);
             }
-            
-            st.store.loadData(avs);
-            st.collapse();
-            st.setValue(cn);
-            
             // flag our selected Node.
             this.tb.selectedNode = sel;