roojs-ui.js
authorAlan Knowles <alan@roojs.com>
Fri, 11 Dec 2015 08:47:47 +0000 (16:47 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 11 Dec 2015 08:47:47 +0000 (16:47 +0800)
roojs-ui-debug.js
roojs-all.js
roojs-debug.js

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

index bda1645..98eb234 100644 (file)
@@ -956,7 +956,7 @@ Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);this.styles=thi
 Roo.form.HtmlEditor.ToolbarContext.types={'IMG':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80},border:{title:"Border",width:40},alt:{title:"Alt",width:120},src:{title:"Src",width:220}},'A':{name:{title:"Name",width:50},target:{title:"Target",width:120},href:{title:"Href",width:220}},'TABLE':{rows:{title:"Rows",width:20},cols:{title:"Cols",width:20},width:{title:"Width",width:40},height:{title:"Height",width:40},border:{title:"Border",width:20}},'TD':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["center"],["right"],["justify"],["char"]],width:80},valign:{title:"Valign",opts:[[""],["top"],["middle"],["bottom"],["baseline"]],width:80},colspan:{title:"Colspan",width:20},'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'INPUT':{name:{title:"name",width:120},value:{title:"Value",width:120},width:{title:"Width",width:40}},'LABEL':{'for':{title:"For",width:120}},'TEXTAREA':{name:{title:"name",width:120},rows:{title:"Rows",width:20},cols:{title:"Cols",width:20}},'SELECT':{name:{title:"name",width:120},selectoptions:{title:"Options",width:200}},'BODY':{title:{title:"Title",width:200,disabled:true}},'SPAN':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'DIV':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'P':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'*':{}};Roo.form.HtmlEditor.ToolbarContext.stores=false;Roo.form.HtmlEditor.ToolbarContext.options={'font-family':[['Helvetica,Arial,sans-serif','Helvetica'],['Courier New','Courier New'],['Tahoma','Tahoma'],['Times New Roman,serif','Times'],['Verdana','Verdana']]};Roo.form.HtmlEditor.ToolbarContext.types
 Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,editorcore:false,disable:false,styles:false,options:false,toolbars:false,init:function(A){this.editor=A;this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:F!==false,scope:B,handler:G||B.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1};}var E=A.wrap.createChild({tag:'div'},A.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}
 this.tb=this.toolbars.BODY;this.tb.el.show();this.buildFooter();this.footer.show();A.on('hide',function(){this.footer.hide()},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=B?false:true;var E=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;if(!B){B=E.length?(E[0]?E[0]:E[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();tn=B.tagName.toUpperCase();var F=this.tb.selectedNode
-this.tb.selectedNode=B;if((this.tb.name!=tn)||(F!=this.tb.selectedNode)){this.tb.el.hide();this.tb=typeof(ty[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=tn+':&nbsp;';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));});}var G=false;for(var i in this.styles){G=true;break;}if(G){var st=this.tb.fields.item(0);st.store.removeAll();var cn=B.className.split(/\s+/);var H=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}
+this.tb.selectedNode=B;if((this.tb.name!=tn)||(F!=this.tb.selectedNode)||ev===false){this.tb.el.hide();this.tb=typeof(ty[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=tn+':&nbsp;';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));});}var G=false;for(var i in this.styles){G=true;break;}if(G){var st=this.tb.fields.item(0);st.store.removeAll();var cn=B.className.split(/\s+/);var H=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}
 st.store.loadData(H);st.collapse();st.setValue(cn);}
 this.tb.selectedNode=B;Roo.menu.MenuMgr.hideAll();}if(!D){return;}var I='';this.footerEls=E.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}
 I+=I.length?' &gt; ':'';I+='<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=I;},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();}}
index 8d56184..c1d9d84 100644 (file)
@@ -41609,7 +41609,8 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         this.execCmd('FontSize', v  );
     },
 
-    onEditorEvent : function(e){
+    onEditorEvent : function(e)
+    {
         this.owner.fireEvent('editorevent', this, e);
       //  this.updateToolbar();
         this.syncValue(); //we can not sync so often.. sync cleans, so this breaks stuff
@@ -44390,6 +44391,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
     /**
      * Protected method that will not generally be called directly. It triggers
      * a toolbar update by reading the markup state of the current selection in the editor.
+     *
+     * Note you can force an update by calling on('editorevent', scope, false)
      */
     updateToolbar: function(editor,ev,sel){
 
@@ -44401,6 +44404,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             return;
         }
         
+        
+        
         // http://developer.yahoo.com/yui/docs/simple-editor.js.html
         // selectNode - might want to handle IE?
         if (ev &&
@@ -44448,7 +44453,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         this.tb.selectedNode = sel;
         
         // if current menu does not match..
-        if ((this.tb.name != tn) || (lastSel != this.tb.selectedNode)) {
+        
+        if ((this.tb.name != tn) || (lastSel != this.tb.selectedNode) || ev === false) {
                 
             this.tb.el.hide();
             ///console.log("show: " + tn);
index 9efecf4..8e00287 100644 (file)
@@ -25163,7 +25163,8 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         this.execCmd('FontSize', v  );
     },
 
-    onEditorEvent : function(e){
+    onEditorEvent : function(e)
+    {
         this.owner.fireEvent('editorevent', this, e);
       //  this.updateToolbar();
         this.syncValue(); //we can not sync so often.. sync cleans, so this breaks stuff
@@ -27944,6 +27945,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
     /**
      * Protected method that will not generally be called directly. It triggers
      * a toolbar update by reading the markup state of the current selection in the editor.
+     *
+     * Note you can force an update by calling on('editorevent', scope, false)
      */
     updateToolbar: function(editor,ev,sel){
 
@@ -27955,6 +27958,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             return;
         }
         
+        
+        
         // http://developer.yahoo.com/yui/docs/simple-editor.js.html
         // selectNode - might want to handle IE?
         if (ev &&
@@ -28002,7 +28007,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         this.tb.selectedNode = sel;
         
         // if current menu does not match..
-        if ((this.tb.name != tn) || (lastSel != this.tb.selectedNode)) {
+        
+        if ((this.tb.name != tn) || (lastSel != this.tb.selectedNode) || ev === false) {
                 
             this.tb.el.hide();
             ///console.log("show: " + tn);
index 251ba1f..47bb6c7 100644 (file)
@@ -621,7 +621,7 @@ Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);this.styles=thi
 Roo.form.HtmlEditor.ToolbarContext.types={'IMG':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80},border:{title:"Border",width:40},alt:{title:"Alt",width:120},src:{title:"Src",width:220}},'A':{name:{title:"Name",width:50},target:{title:"Target",width:120},href:{title:"Href",width:220}},'TABLE':{rows:{title:"Rows",width:20},cols:{title:"Cols",width:20},width:{title:"Width",width:40},height:{title:"Height",width:40},border:{title:"Border",width:20}},'TD':{width:{title:"Width",width:40},height:{title:"Height",width:40},align:{title:"Align",opts:[[""],["left"],["center"],["right"],["justify"],["char"]],width:80},valign:{title:"Valign",opts:[[""],["top"],["middle"],["bottom"],["baseline"]],width:80},colspan:{title:"Colspan",width:20},'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'INPUT':{name:{title:"name",width:120},value:{title:"Value",width:120},width:{title:"Width",width:40}},'LABEL':{'for':{title:"For",width:120}},'TEXTAREA':{name:{title:"name",width:120},rows:{title:"Rows",width:20},cols:{title:"Cols",width:20}},'SELECT':{name:{title:"name",width:120},selectoptions:{title:"Options",width:200}},'BODY':{title:{title:"Title",width:200,disabled:true}},'SPAN':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'DIV':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'P':{'font-family':{title:"Font",style:'fontFamily',displayField:'display',optname:'font-family',width:140}},'*':{}};Roo.form.HtmlEditor.ToolbarContext.stores=false;Roo.form.HtmlEditor.ToolbarContext.options={'font-family':[['Helvetica,Arial,sans-serif','Helvetica'],['Courier New','Courier New'],['Tahoma','Tahoma'],['Times New Roman,serif','Times'],['Verdana','Verdana']]};Roo.form.HtmlEditor.ToolbarContext.types
 Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,editorcore:false,disable:false,styles:false,options:false,toolbars:false,init:function(A){this.editor=A;this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:F!==false,scope:B,handler:G||B.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1};}var E=A.wrap.createChild({tag:'div'},A.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}
 this.tb=this.toolbars.BODY;this.tb.el.show();this.buildFooter();this.footer.show();A.on('hide',function(){this.footer.hide()},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=B?false:true;var E=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;if(!B){B=E.length?(E[0]?E[0]:E[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();tn=B.tagName.toUpperCase();var F=this.tb.selectedNode
-this.tb.selectedNode=B;if((this.tb.name!=tn)||(F!=this.tb.selectedNode)){this.tb.el.hide();this.tb=typeof(ty[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=tn+':&nbsp;';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));});}var G=false;for(var i in this.styles){G=true;break;}if(G){var st=this.tb.fields.item(0);st.store.removeAll();var cn=B.className.split(/\s+/);var H=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}
+this.tb.selectedNode=B;if((this.tb.name!=tn)||(F!=this.tb.selectedNode)||ev===false){this.tb.el.hide();this.tb=typeof(ty[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=tn+':&nbsp;';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));});}var G=false;for(var i in this.styles){G=true;break;}if(G){var st=this.tb.fields.item(0);st.store.removeAll();var cn=B.className.split(/\s+/);var H=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){H.push([v,cn.indexOf(v)>-1?1:0]);});}
 st.store.loadData(H);st.collapse();st.setValue(cn);}
 this.tb.selectedNode=B;Roo.menu.MenuMgr.hideAll();}if(!D){return;}var I='';this.footerEls=E.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}
 I+=I.length?' &gt; ':'';I+='<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=I;},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();}}