roojs-ui.js
authorAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:33:54 +0000 (17:33 +0800)
committerAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:33:54 +0000 (17:33 +0800)
roojs-ui-debug.js
roojs-all.js
roojs-debug.js
roojs-core.js
roojs-core-debug.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 12adc41..3af9079 100644 (file)
@@ -2001,19 +2001,20 @@ var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:
 ,this);A.on('show',function(){this.footer.show()},this);this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(A,ev,B){if(!this.editorcore.activated){this.editor.onFirstFocus();return;}if(ev&&(ev.type=='mouseup'||ev.type=='click')&&ev.target&&ev.target.tagName=='IMG'){B=ev.target;
 var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}var s=this.editorcore.win.getSelection();s.removeAllRanges();s.addRange(C);}var D=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;
 if(!B){B=D.length?(D[0]?D[0]:D[1]):this.editorcore.doc.body;B=B?B:this.editorcore.doc.body;B=B.tagName.length?B:this.editorcore.doc.body;}var tn=B.tagName.toUpperCase();var E=this.tb.selectedNode;this.tb.selectedNode=B;var F=tn;var db=Roo.get(B).findParent('[data-block]');
-if(db){var G=Roo.htmleditor['Block'+Roo.get(db).attr('data-block')];if(typeof(G)=='undefined'){tn='*';Roo.log("OOps missing block : "+'Block'+Roo.get(db).attr('data-block'));}else{tn='BLOCK.'+db.getAttribute('data-block');this.tb.selectedNode=db;if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(G.prototype.context,tn,G.prototype.friendly_name);
-}F=G.prototype.friendly_name;}}if(this.tb.name==tn&&E==this.tb.selectedNode&&ev!==false){return;}this.tb.el.hide();this.tb=typeof(this.toolbars[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=F+':&nbsp;';
-if(db){var H=new G({node:B});this.tb.fields.each(function(e){e.setValue(dob[e.attrname]);});}else if(this.tb.fields){this.tb.fields.each(function(e){if(e.stylename){e.setValue(B.style[e.stylename]);return;}e.setValue(B.getAttribute(e.attrname));});}this.updateToolbarStyles(B);
-this.tb.selectedNode=B;Roo.menu.MenuMgr.hideAll();this.updateFooter(D);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B){var st=this.tb.fields.item(0);st.store.removeAll();var cn=A.className.split(/\s+/);var C=[];
-if(this.styles['*']){Roo.each(this.styles['*'],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}st.store.loadData(C);st.collapse();st.setValue(cn);}},updateFooter:function(A){var B='';
-if(A===false){this.footDisp.dom.innerHTML='';return;}this.footerEls=A.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}B+=B.length?' &gt; ':'';B+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';});var sz=this.footDisp.up('td').getSize();
-this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=B;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();
-if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(A,nm,B){var C=this.editor;var D=this.editorcore;var E=C.wrap.createChild({tag:'div'},C.wrap.dom.firstChild.nextSibling,true);
-var tb=new Roo.Toolbar(E);tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var F=Array.from(this.styles);if(F&&F.length){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'-roo-edit-className',attrname:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';
+var G=false;if(db){G=Roo.htmleditor.Block.factory(db);if(G){tn='BLOCK.'+db.getAttribute('data-block');this.tb.selectedNode=db;if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(G.context,tn,G.friendly_name);}F=G.friendly_name;}
+}if(this.tb.name==tn&&E==this.tb.selectedNode&&ev!==false){return;}this.tb.el.hide();this.tb=typeof(this.toolbars[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=F+':&nbsp;';if(db){var H=new cls({node:B}
+);this.tb.fields.each(function(e){e.setValue(dob[e.attrname]);});}else if(this.tb.fields){this.tb.fields.each(function(e){if(e.stylename){e.setValue(B.style[e.stylename]);return;}e.setValue(B.getAttribute(e.attrname));});}this.updateToolbarStyles(B);this.tb.selectedNode=B;
+Roo.menu.MenuMgr.hideAll();this.updateFooter(D);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B){var st=this.tb.fields.item(0);st.store.removeAll();var cn=A.className.split(/\s+/);var C=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);
+});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}st.store.loadData(C);st.collapse();st.setValue(cn);}},updateFooter:function(A){var B='';if(A===false){this.footDisp.dom.innerHTML='';return;}this.footerEls=A.reverse();
+Roo.each(this.footerEls,function(a,i){if(!a){return;}B+=B.length?' &gt; ':'';B+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';});var sz=this.footDisp.up('td').getSize();this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';
+this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=B;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();
+});},buildToolbar:function(A,nm,B){var C=this.editor;var D=this.editorcore;var E=C.wrap.createChild({tag:'div'},C.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(E);tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var F=Array.from(this.styles);
+if(F&&F.length){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'-roo-edit-className',attrname:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';
 D.syncValue();}}}));}var G=Roo.form.HtmlEditor.ToolbarContext;for(var i in A){var H=A[i];tb.add(H.title+":&nbsp;");var I=H.opts?H.opts:false;if(H.optname){I=Roo.form.HtmlEditor.ToolbarContext.options[H.optname];}if(I){tb.addField(new Roo.form.ComboBox({store:typeof(G.stores[i])!='undefined'?Roo.factory(G.stores[i],Roo.data):new Roo.data.SimpleStore({id:'val',fields:['val','display'],data:I}
 ),name:'-roo-edit-'+i,attrname:i,stylename:H.style?H.style:false,displayField:H.displayField?H.displayField:'val',valueField:'val',typeAhead:false,mode:typeof(G.stores[i])!='undefined'?'remote':'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:H.width?H.width:130,listeners:{'select':function(c,r,i){if(tb.selectedNode.hasClass('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
-b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
-}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+i,attrname:i,width:H.width,value:'',listeners:{'change':function(f,nv,ov){tb.selectedNode.setAttribute(f.attrname,nv);D.syncValue();}}}));}var J=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){J.editor.fireEvent('stylesheetsclick',J.editor);
+b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);D.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');D.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);D.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
+D.syncValue();}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+i,attrname:i,width:H.width,value:'',listeners:{'change':function(f,nv,ov){if(tb.selectedNode.hasClass('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);b[c.attrname]=nv;
+b.updateElement(tb.selectedNode);D.syncValue();return;}tb.selectedNode.setAttribute(f.attrname,nv);D.syncValue();}}}));}var J=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){J.editor.fireEvent('stylesheetsclick',J.editor);
 }}});}tb.addFill();tb.addButton({text:'Remove',listeners:{click:function(){var sn=tb.selectedNode;var K=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||pn;if(sn.hasAttribute('data-block')){sn.parentNode.removeChild(sn);}else{a=new Roo.htmleditor.FilterKeepChildren({tag:false}
 );a.removeTag(sn);}var L=D.createRange();L.setStart(K,0);L.setEnd(en,0);var M=D.getSelection();M.removeAllRanges();M.addRange(L);J.updateToolbar(null,null,null);J.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);
 tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}
index 93ea871..65b533e 100644 (file)
@@ -48580,23 +48580,20 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         // ok see if we are editing a block?
         
         var db = Roo.get(sel).findParent('[data-block]');
+        var block = false;
         if (db) {
-            var cls = Roo.htmleditor['Block' + Roo.get(db).attr('data-block')];
-            if (typeof(cls) == 'undefined') {
-                tn = '*';
-                Roo.log("OOps missing block : " + 'Block' + Roo.get(db).attr('data-block'));
-                
-            } else {
-               
-            
+            block = Roo.htmleditor.Block.factory(db);
+            if (block) {
                 tn = 'BLOCK.' + db.getAttribute('data-block');
                 this.tb.selectedNode = db;
                 if (typeof(this.toolbars[tn]) == 'undefined') {
-                   this.toolbars[tn] = this.buildToolbar( cls.prototype.context,tn ,cls.prototype.friendly_name);
+                   this.toolbars[tn] = this.buildToolbar( block.context,tn ,block.friendly_name);
                 }
-                left_label = cls.prototype.friendly_name;
+                left_label = block.friendly_name;
             }
             
+                
+            
         }
         
         
@@ -48829,18 +48826,22 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                                 var b = Roo.htmleditor.Block.factory(tb.selectedNode);
                                 b[c.attrname] = r.get('val');
                                 b.updateElement(tb.selectedNode);
+                                editorcore.syncValue();
                                 return;
                             }
                             
                             if (c.stylename) {
                                 tb.selectedNode.style[c.stylename] =  r.get('val');
+                                editorcore.syncValue();
                                 return;
                             }
                             if (r === false) {
                                 tb.selectedNode.removeAttribute(c.attrname);
+                                editorcore.syncValue();
                                 return;
                             }
                             tb.selectedNode.setAttribute(c.attrname, r.get('val'));
+                            editorcore.syncValue();
                         }
                     }
 
@@ -48867,6 +48868,15 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                 value: '',
                 listeners: {
                     'change' : function(f, nv, ov) {
+                        
+                        if (tb.selectedNode.hasClass('data-block')) {
+                            var b = Roo.htmleditor.Block.factory(tb.selectedNode);
+                            b[c.attrname] = nv;
+                            b.updateElement(tb.selectedNode);
+                            editorcore.syncValue();
+                            return;
+                        }
+                        
                         tb.selectedNode.setAttribute(f.attrname, nv);
                         editorcore.syncValue();
                     }
index e48ec0c..47a636c 100644 (file)
@@ -24612,23 +24612,20 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         // ok see if we are editing a block?
         
         var db = Roo.get(sel).findParent('[data-block]');
+        var block = false;
         if (db) {
-            var cls = Roo.htmleditor['Block' + Roo.get(db).attr('data-block')];
-            if (typeof(cls) == 'undefined') {
-                tn = '*';
-                Roo.log("OOps missing block : " + 'Block' + Roo.get(db).attr('data-block'));
-                
-            } else {
-               
-            
+            block = Roo.htmleditor.Block.factory(db);
+            if (block) {
                 tn = 'BLOCK.' + db.getAttribute('data-block');
                 this.tb.selectedNode = db;
                 if (typeof(this.toolbars[tn]) == 'undefined') {
-                   this.toolbars[tn] = this.buildToolbar( cls.prototype.context,tn ,cls.prototype.friendly_name);
+                   this.toolbars[tn] = this.buildToolbar( block.context,tn ,block.friendly_name);
                 }
-                left_label = cls.prototype.friendly_name;
+                left_label = block.friendly_name;
             }
             
+                
+            
         }
         
         
@@ -24861,18 +24858,22 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                                 var b = Roo.htmleditor.Block.factory(tb.selectedNode);
                                 b[c.attrname] = r.get('val');
                                 b.updateElement(tb.selectedNode);
+                                editorcore.syncValue();
                                 return;
                             }
                             
                             if (c.stylename) {
                                 tb.selectedNode.style[c.stylename] =  r.get('val');
+                                editorcore.syncValue();
                                 return;
                             }
                             if (r === false) {
                                 tb.selectedNode.removeAttribute(c.attrname);
+                                editorcore.syncValue();
                                 return;
                             }
                             tb.selectedNode.setAttribute(c.attrname, r.get('val'));
+                            editorcore.syncValue();
                         }
                     }
 
@@ -24899,6 +24900,15 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                 value: '',
                 listeners: {
                     'change' : function(f, nv, ov) {
+                        
+                        if (tb.selectedNode.hasClass('data-block')) {
+                            var b = Roo.htmleditor.Block.factory(tb.selectedNode);
+                            b[c.attrname] = nv;
+                            b.updateElement(tb.selectedNode);
+                            editorcore.syncValue();
+                            return;
+                        }
+                        
                         tb.selectedNode.setAttribute(f.attrname, nv);
                         editorcore.syncValue();
                     }
index 79b5c0c..989bf00 100644 (file)
@@ -1077,19 +1077,20 @@ var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:
 ,this);A.on('show',function(){this.footer.show()},this);this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(A,ev,B){if(!this.editorcore.activated){this.editor.onFirstFocus();return;}if(ev&&(ev.type=='mouseup'||ev.type=='click')&&ev.target&&ev.target.tagName=='IMG'){B=ev.target;
 var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}var s=this.editorcore.win.getSelection();s.removeAllRanges();s.addRange(C);}var D=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;
 if(!B){B=D.length?(D[0]?D[0]:D[1]):this.editorcore.doc.body;B=B?B:this.editorcore.doc.body;B=B.tagName.length?B:this.editorcore.doc.body;}var tn=B.tagName.toUpperCase();var E=this.tb.selectedNode;this.tb.selectedNode=B;var F=tn;var db=Roo.get(B).findParent('[data-block]');
-if(db){var G=Roo.htmleditor['Block'+Roo.get(db).attr('data-block')];if(typeof(G)=='undefined'){tn='*';Roo.log("OOps missing block : "+'Block'+Roo.get(db).attr('data-block'));}else{tn='BLOCK.'+db.getAttribute('data-block');this.tb.selectedNode=db;if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(G.prototype.context,tn,G.prototype.friendly_name);
-}F=G.prototype.friendly_name;}}if(this.tb.name==tn&&E==this.tb.selectedNode&&ev!==false){return;}this.tb.el.hide();this.tb=typeof(this.toolbars[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=F+':&nbsp;';
-if(db){var H=new G({node:B});this.tb.fields.each(function(e){e.setValue(dob[e.attrname]);});}else if(this.tb.fields){this.tb.fields.each(function(e){if(e.stylename){e.setValue(B.style[e.stylename]);return;}e.setValue(B.getAttribute(e.attrname));});}this.updateToolbarStyles(B);
-this.tb.selectedNode=B;Roo.menu.MenuMgr.hideAll();this.updateFooter(D);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B){var st=this.tb.fields.item(0);st.store.removeAll();var cn=A.className.split(/\s+/);var C=[];
-if(this.styles['*']){Roo.each(this.styles['*'],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}st.store.loadData(C);st.collapse();st.setValue(cn);}},updateFooter:function(A){var B='';
-if(A===false){this.footDisp.dom.innerHTML='';return;}this.footerEls=A.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}B+=B.length?' &gt; ':'';B+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';});var sz=this.footDisp.up('td').getSize();
-this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=B;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();
-if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(A,nm,B){var C=this.editor;var D=this.editorcore;var E=C.wrap.createChild({tag:'div'},C.wrap.dom.firstChild.nextSibling,true);
-var tb=new Roo.Toolbar(E);tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var F=Array.from(this.styles);if(F&&F.length){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'-roo-edit-className',attrname:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';
+var G=false;if(db){G=Roo.htmleditor.Block.factory(db);if(G){tn='BLOCK.'+db.getAttribute('data-block');this.tb.selectedNode=db;if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(G.context,tn,G.friendly_name);}F=G.friendly_name;}
+}if(this.tb.name==tn&&E==this.tb.selectedNode&&ev!==false){return;}this.tb.el.hide();this.tb=typeof(this.toolbars[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=F+':&nbsp;';if(db){var H=new cls({node:B}
+);this.tb.fields.each(function(e){e.setValue(dob[e.attrname]);});}else if(this.tb.fields){this.tb.fields.each(function(e){if(e.stylename){e.setValue(B.style[e.stylename]);return;}e.setValue(B.getAttribute(e.attrname));});}this.updateToolbarStyles(B);this.tb.selectedNode=B;
+Roo.menu.MenuMgr.hideAll();this.updateFooter(D);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B){var st=this.tb.fields.item(0);st.store.removeAll();var cn=A.className.split(/\s+/);var C=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);
+});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}st.store.loadData(C);st.collapse();st.setValue(cn);}},updateFooter:function(A){var B='';if(A===false){this.footDisp.dom.innerHTML='';return;}this.footerEls=A.reverse();
+Roo.each(this.footerEls,function(a,i){if(!a){return;}B+=B.length?' &gt; ':'';B+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';});var sz=this.footDisp.up('td').getSize();this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';
+this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=B;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();
+});},buildToolbar:function(A,nm,B){var C=this.editor;var D=this.editorcore;var E=C.wrap.createChild({tag:'div'},C.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(E);tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var F=Array.from(this.styles);
+if(F&&F.length){tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}),name:'-roo-edit-className',attrname:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';
 D.syncValue();}}}));}var G=Roo.form.HtmlEditor.ToolbarContext;for(var i in A){var H=A[i];tb.add(H.title+":&nbsp;");var I=H.opts?H.opts:false;if(H.optname){I=Roo.form.HtmlEditor.ToolbarContext.options[H.optname];}if(I){tb.addField(new Roo.form.ComboBox({store:typeof(G.stores[i])!='undefined'?Roo.factory(G.stores[i],Roo.data):new Roo.data.SimpleStore({id:'val',fields:['val','display'],data:I}
 ),name:'-roo-edit-'+i,attrname:i,stylename:H.style?H.style:false,displayField:H.displayField?H.displayField:'val',valueField:'val',typeAhead:false,mode:typeof(G.stores[i])!='undefined'?'remote':'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:H.width?H.width:130,listeners:{'select':function(c,r,i){if(tb.selectedNode.hasClass('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
-b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
-}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+i,attrname:i,width:H.width,value:'',listeners:{'change':function(f,nv,ov){tb.selectedNode.setAttribute(f.attrname,nv);D.syncValue();}}}));}var J=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){J.editor.fireEvent('stylesheetsclick',J.editor);
+b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);D.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');D.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);D.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
+D.syncValue();}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+i,attrname:i,width:H.width,value:'',listeners:{'change':function(f,nv,ov){if(tb.selectedNode.hasClass('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);b[c.attrname]=nv;
+b.updateElement(tb.selectedNode);D.syncValue();return;}tb.selectedNode.setAttribute(f.attrname,nv);D.syncValue();}}}));}var J=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){J.editor.fireEvent('stylesheetsclick',J.editor);
 }}});}tb.addFill();tb.addButton({text:'Remove',listeners:{click:function(){var sn=tb.selectedNode;var K=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||pn;if(sn.hasAttribute('data-block')){sn.parentNode.removeChild(sn);}else{a=new Roo.htmleditor.FilterKeepChildren({tag:false}
 );a.removeTag(sn);}var L=D.createRange();L.setStart(K,0);L.setEnd(en,0);var M=D.getSelection();M.removeAllRanges();M.addRange(L);J.updateToolbar(null,null,null);J.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);
 tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}