roojs-ui.js
authorAlan <alan@roojs.com>
Fri, 17 Dec 2021 03:33:49 +0000 (11:33 +0800)
committerAlan <alan@roojs.com>
Fri, 17 Dec 2021 03:33:49 +0000 (11:33 +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 fa6dba9..15798a8 100644 (file)
@@ -2072,17 +2072,17 @@ this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var C=B.frameI
 ;}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(ev){ev.stopEvent();}if(!this.editorcore.activated){this.editor.onFirstFocus();
 return;}if(ev&&(ev.type=='mouseup'||ev.type=='click')&&ev.target&&ev.target.tagName!='BODY'){B=ev.target;}Roo.select('.roo-ed-selection',false,this.editorcore.doc).removeClass('roo-ed-selection');var C=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;
-if(!B){B=C.length?(C[0]?C[0]:C[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 D=this.tb.selectedNode;this.tb.selectedNode=B;var E=tn;var F=Roo.get(B);var db=false;
-if(B&&B.hasAttribute('data-block')){db=B;}else if(B&&!B.hasAttribute('contenteditable')){db=F.findParent('[data-block]');var G=F.findParent('[contenteditable=true]');if(db&&G&&G.tagName!='BODY'){db=false;}}var H=false;if(db){H=Roo.htmleditor.Block.factory(db);
-if(H){db.className+=' roo-ed-selection';tn='BLOCK.'+db.getAttribute('data-block');if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(false,tn,H.friendly_name,H);}this.toolbars[tn].selectedNode=db;E=H.friendly_name;C=this.editorcore.getAllAncestors();
-}}if(this.tb.name==tn&&D==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=E+':&nbsp;';if(H){this.tb.fields.each(function(e){e.setValue(H[e.name]);
-});}else if(this.tb.fields&&this.tb.selectedNode){this.tb.fields.each(function(e){if(e.stylename){e.setValue(this.tb.selectedNode.style[e.stylename]);return;}e.setValue(this.tb.selectedNode.getAttribute(e.attrname));},this);this.updateToolbarStyles(this.tb.selectedNode);
-}Roo.menu.MenuMgr.hideAll();this.updateFooter(C);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B&&this.tb.hasStyles){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,C){var D=this.editor;var E=this.editorcore;var F=D.wrap.createChild({tag:'div'},D.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(F);if(A===false&&C){A=C.contextMenu(this);}tb.hasStyles=false;tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");
-var G=Array.from(this.styles);if(G&&G.length){tb.hasStyles=true;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'):'';
+if(!B){B=C.length?(C[0]?C[0]:C[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 D=this.tb.selectedNode;this.tb.selectedNode=B;var E=tn;var db=false;if(B&&B.hasAttribute('data-block')){db=B;
+}else if(B&&!B.hasAttribute('contenteditable')){var F=Roo.get(B);db=F.findParent('[data-block]');var G=F.findParent('[contenteditable=true]');if(db&&G&&G.tagName!='BODY'){db=false;}}var H=false;if(db){H=Roo.htmleditor.Block.factory(db);if(H){db.className+=' roo-ed-selection';
+tn='BLOCK.'+db.getAttribute('data-block');if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(false,tn,H.friendly_name,H);}this.toolbars[tn].selectedNode=db;E=H.friendly_name;C=this.editorcore.getAllAncestors();}}if(this.tb.name==tn&&D==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=E+':&nbsp;';if(H){this.tb.fields.each(function(e){e.setValue(H[e.name]);});}else if(this.tb.fields&&this.tb.selectedNode){this.tb.fields.each(function(e){if(e.stylename){e.setValue(this.tb.selectedNode.style[e.stylename]);
+return;}e.setValue(this.tb.selectedNode.getAttribute(e.attrname));},this);this.updateToolbarStyles(this.tb.selectedNode);}Roo.menu.MenuMgr.hideAll();this.updateFooter(C);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;
+}if(B&&this.tb.hasStyles){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,C){var D=this.editor;var E=this.editorcore;var F=D.wrap.createChild({tag:'div'},D.wrap.dom.firstChild.nextSibling,true);
+var tb=new Roo.Toolbar(F);if(A===false&&C){A=C.contextMenu(this);}tb.hasStyles=false;tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var G=Array.from(this.styles);if(G&&G.length){tb.hasStyles=true;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'):'';
 E.syncValue();}}}));}var H=Roo.form.HtmlEditor.ToolbarContext;for(var i=0;i<A.length;i++){if(typeof(A[i].xtype)!='undefined'){tb[typeof(A[i].name)=='undefined'?'add':'addField'](Roo.factory(A[i]));continue;}var I=A[i];tb.add(I.title+":&nbsp;");var J=I.opts?I.opts:false;
 if(I.optname){J=Roo.form.HtmlEditor.ToolbarContext.options[I.optname];}if(J){tb.addField(new Roo.form.ComboBox({store:typeof(H.stores[i])!='undefined'?Roo.factory(H.stores[i],Roo.data):new Roo.data.SimpleStore({id:'val',fields:['val','display'],data:J}),name:'-roo-edit-'+A[i].name,attrname:A[i].name,stylename:I.style?I.style:false,displayField:I.displayField?I.displayField:'val',valueField:'val',typeAhead:false,mode:typeof(H.stores[A[i].name])!='undefined'?'remote':'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:I.width?I.width:130,listeners:{'select':function(c,r,i){if(tb.selectedNode.hasAttribute('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
 b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);E.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');E.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);E.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
index 3c8208f..8d6ac9c 100644 (file)
@@ -49748,12 +49748,13 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         var left_label = tn;
         
         // ok see if we are editing a block?
-        var sel_el = Roo.get(sel);
+        
         var db = false;
         // you are not actually selecting the block.
         if (sel && sel.hasAttribute('data-block')) {
             db = sel;
         } else if (sel && !sel.hasAttribute('contenteditable')) {
+            var sel_el = Roo.get(sel);
             db = sel_el.findParent('[data-block]');
             var cepar = sel_el.findParent('[contenteditable=true]');
             if (db && cepar && cepar.tagName != 'BODY') {
index 7e6e1db..6961941 100644 (file)
@@ -25477,12 +25477,13 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         var left_label = tn;
         
         // ok see if we are editing a block?
-        var sel_el = Roo.get(sel);
+        
         var db = false;
         // you are not actually selecting the block.
         if (sel && sel.hasAttribute('data-block')) {
             db = sel;
         } else if (sel && !sel.hasAttribute('contenteditable')) {
+            var sel_el = Roo.get(sel);
             db = sel_el.findParent('[data-block]');
             var cepar = sel_el.findParent('[contenteditable=true]');
             if (db && cepar && cepar.tagName != 'BODY') {
index 98051bb..b33cf28 100644 (file)
@@ -1137,17 +1137,17 @@ this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var C=B.frameI
 ;}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(ev){ev.stopEvent();}if(!this.editorcore.activated){this.editor.onFirstFocus();
 return;}if(ev&&(ev.type=='mouseup'||ev.type=='click')&&ev.target&&ev.target.tagName!='BODY'){B=ev.target;}Roo.select('.roo-ed-selection',false,this.editorcore.doc).removeClass('roo-ed-selection');var C=this.editorcore.getAllAncestors();var ty=Roo.form.HtmlEditor.ToolbarContext.types;
-if(!B){B=C.length?(C[0]?C[0]:C[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 D=this.tb.selectedNode;this.tb.selectedNode=B;var E=tn;var F=Roo.get(B);var db=false;
-if(B&&B.hasAttribute('data-block')){db=B;}else if(B&&!B.hasAttribute('contenteditable')){db=F.findParent('[data-block]');var G=F.findParent('[contenteditable=true]');if(db&&G&&G.tagName!='BODY'){db=false;}}var H=false;if(db){H=Roo.htmleditor.Block.factory(db);
-if(H){db.className+=' roo-ed-selection';tn='BLOCK.'+db.getAttribute('data-block');if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(false,tn,H.friendly_name,H);}this.toolbars[tn].selectedNode=db;E=H.friendly_name;C=this.editorcore.getAllAncestors();
-}}if(this.tb.name==tn&&D==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=E+':&nbsp;';if(H){this.tb.fields.each(function(e){e.setValue(H[e.name]);
-});}else if(this.tb.fields&&this.tb.selectedNode){this.tb.fields.each(function(e){if(e.stylename){e.setValue(this.tb.selectedNode.style[e.stylename]);return;}e.setValue(this.tb.selectedNode.getAttribute(e.attrname));},this);this.updateToolbarStyles(this.tb.selectedNode);
-}Roo.menu.MenuMgr.hideAll();this.updateFooter(C);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;}if(B&&this.tb.hasStyles){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,C){var D=this.editor;var E=this.editorcore;var F=D.wrap.createChild({tag:'div'},D.wrap.dom.firstChild.nextSibling,true);var tb=new Roo.Toolbar(F);if(A===false&&C){A=C.contextMenu(this);}tb.hasStyles=false;tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");
-var G=Array.from(this.styles);if(G&&G.length){tb.hasStyles=true;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'):'';
+if(!B){B=C.length?(C[0]?C[0]:C[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 D=this.tb.selectedNode;this.tb.selectedNode=B;var E=tn;var db=false;if(B&&B.hasAttribute('data-block')){db=B;
+}else if(B&&!B.hasAttribute('contenteditable')){var F=Roo.get(B);db=F.findParent('[data-block]');var G=F.findParent('[contenteditable=true]');if(db&&G&&G.tagName!='BODY'){db=false;}}var H=false;if(db){H=Roo.htmleditor.Block.factory(db);if(H){db.className+=' roo-ed-selection';
+tn='BLOCK.'+db.getAttribute('data-block');if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(false,tn,H.friendly_name,H);}this.toolbars[tn].selectedNode=db;E=H.friendly_name;C=this.editorcore.getAllAncestors();}}if(this.tb.name==tn&&D==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=E+':&nbsp;';if(H){this.tb.fields.each(function(e){e.setValue(H[e.name]);});}else if(this.tb.fields&&this.tb.selectedNode){this.tb.fields.each(function(e){if(e.stylename){e.setValue(this.tb.selectedNode.style[e.stylename]);
+return;}e.setValue(this.tb.selectedNode.getAttribute(e.attrname));},this);this.updateToolbarStyles(this.tb.selectedNode);}Roo.menu.MenuMgr.hideAll();this.updateFooter(C);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;
+}if(B&&this.tb.hasStyles){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,C){var D=this.editor;var E=this.editorcore;var F=D.wrap.createChild({tag:'div'},D.wrap.dom.firstChild.nextSibling,true);
+var tb=new Roo.Toolbar(F);if(A===false&&C){A=C.contextMenu(this);}tb.hasStyles=false;tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var G=Array.from(this.styles);if(G&&G.length){tb.hasStyles=true;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'):'';
 E.syncValue();}}}));}var H=Roo.form.HtmlEditor.ToolbarContext;for(var i=0;i<A.length;i++){if(typeof(A[i].xtype)!='undefined'){tb[typeof(A[i].name)=='undefined'?'add':'addField'](Roo.factory(A[i]));continue;}var I=A[i];tb.add(I.title+":&nbsp;");var J=I.opts?I.opts:false;
 if(I.optname){J=Roo.form.HtmlEditor.ToolbarContext.options[I.optname];}if(J){tb.addField(new Roo.form.ComboBox({store:typeof(H.stores[i])!='undefined'?Roo.factory(H.stores[i],Roo.data):new Roo.data.SimpleStore({id:'val',fields:['val','display'],data:J}),name:'-roo-edit-'+A[i].name,attrname:A[i].name,stylename:I.style?I.style:false,displayField:I.displayField?I.displayField:'val',valueField:'val',typeAhead:false,mode:typeof(H.stores[A[i].name])!='undefined'?'remote':'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:I.width?I.width:130,listeners:{'select':function(c,r,i){if(tb.selectedNode.hasAttribute('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
 b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);E.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');E.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);E.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));