roojs-ui.js
authorAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:10:35 +0000 (17:10 +0800)
committerAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:10:35 +0000 (17:10 +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 2aecb67..75fabe0 100644 (file)
@@ -2003,13 +2003,14 @@ var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:
 ,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=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 db=Roo.get(B).findParent('[data-block]');
-if(db){var F=Roo.htmleditor['Block'+Roo.get(db).attr('data-block')];if(typeof(F)=='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(F.prototype.context,tn,F.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=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));});}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(!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'):'';
 D.syncValue();}}}));}var G=Roo.form.HtmlEditor.ToolbarContext;var H=G.options;for(var i in A){var I=A[i];tb.add(I.title+":&nbsp;");var J=I.opts?I.opts:false;if(I.optname){J=H[I.optname];}if(J){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:J}
index 42b3db1..88d3050 100644 (file)
@@ -48597,7 +48597,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         var tn = sel.tagName.toUpperCase();
         var lastSel = this.tb.selectedNode;
         this.tb.selectedNode = sel;
-        
+        var left_label = tn;
         
         // ok see if we are editing a block?
         
@@ -48616,6 +48616,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                 if (typeof(this.toolbars[tn]) == 'undefined') {
                    this.toolbars[tn] = this.buildToolbar( cls.prototype.context,tn ,cls.prototype.friendly_name);
                 }
+                left_label = cls.prototype.friendly_name;
             }
             
         }
@@ -48633,17 +48634,24 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         
         this.tb.el.show();
         // update name
-        this.tb.items.first().el.innerHTML = tn + ':&nbsp;';
+        this.tb.items.first().el.innerHTML = left_label + ':&nbsp;';
         
         
         // update attributes
-        if (this.tb.fields) {
+        if (db) {
+            var dbo = new cls({node : sel});
+            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(sel.style[e.stylename]);
                     return;
                 } 
-               e.setValue(sel.getAttribute(e.attrname));
+                e.setValue(sel.getAttribute(e.attrname));
             });
         }
         this.updateToolbarStyles(sel);  
index b29cba9..a84532a 100644 (file)
@@ -24629,7 +24629,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         var tn = sel.tagName.toUpperCase();
         var lastSel = this.tb.selectedNode;
         this.tb.selectedNode = sel;
-        
+        var left_label = tn;
         
         // ok see if we are editing a block?
         
@@ -24648,6 +24648,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                 if (typeof(this.toolbars[tn]) == 'undefined') {
                    this.toolbars[tn] = this.buildToolbar( cls.prototype.context,tn ,cls.prototype.friendly_name);
                 }
+                left_label = cls.prototype.friendly_name;
             }
             
         }
@@ -24665,17 +24666,24 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         
         this.tb.el.show();
         // update name
-        this.tb.items.first().el.innerHTML = tn + ':&nbsp;';
+        this.tb.items.first().el.innerHTML = left_label + ':&nbsp;';
         
         
         // update attributes
-        if (this.tb.fields) {
+        if (db) {
+            var dbo = new cls({node : sel});
+            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(sel.style[e.stylename]);
                     return;
                 } 
-               e.setValue(sel.getAttribute(e.attrname));
+                e.setValue(sel.getAttribute(e.attrname));
             });
         }
         this.updateToolbarStyles(sel);  
index 5fe03ee..c14e2f7 100644 (file)
@@ -1079,13 +1079,14 @@ var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:
 ,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=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 db=Roo.get(B).findParent('[data-block]');
-if(db){var F=Roo.htmleditor['Block'+Roo.get(db).attr('data-block')];if(typeof(F)=='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(F.prototype.context,tn,F.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=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));});}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(!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'):'';
 D.syncValue();}}}));}var G=Roo.form.HtmlEditor.ToolbarContext;var H=G.options;for(var i in A){var I=A[i];tb.add(I.title+":&nbsp;");var J=I.opts?I.opts:false;if(I.optname){J=H[I.optname];}if(J){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:J}