Roo/htmleditor/BlockFigure.js
authorleon <leon@roojs.com>
Mon, 25 Sep 2023 03:00:30 +0000 (11:00 +0800)
committerleon <leon@roojs.com>
Mon, 25 Sep 2023 03:00:30 +0000 (11:00 +0800)
roojs-core.js
roojs-core-debug.js
roojs-ui.js
roojs-ui-debug.js
roojs-all.js
roojs-debug.js

Roo/htmleditor/BlockFigure.js
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index eb3b09d..30d2724 100644 (file)
@@ -452,14 +452,13 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
             this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         }
 
+        this.caption_align = this.getValue(node, true, 'data-caption-align');
+
         // read caption from figcaption
         var figcaption = this.getVal(node, 'figcaption', false);
 
         if (figcaption !== '') {
             this.caption = this.getVal(figcaption, 'i', 'html');
-            this.caption_align = this.getVal(figcaption, 'div', 'text-align', 'style');
-            Roo.log('CAPTION ALIGN');
-            Roo.log(this.caption_align);
         }
                 
 
index 4dd8ff8..b6cc0bc 100644 (file)
@@ -2015,13 +2015,12 @@ this.setPressed(v!='block');},listeners:{toggle:function(F,G){var b=B();b.captio
 A.editorcore.onEditorEvent();}},xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'caption_align',listeners:{render:function(F){A.captionAlign=this;
 },select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode);var b=B();b.caption_align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right']],fields:['val'],xns:Roo.data}}];
 },toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m}
-};if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,'data-caption-display':this.caption_display,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align}
+};if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,'data-caption-display':this.caption_display,'data-caption-align':this.caption_align,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align}
 ,align:this.align,cn:[A]};if(this.caption_display=='block'){B['cn'].push({tag:'figcaption',style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:(this.align=='center'?this.width:'100%')+' !important',margin:m,width:this.align=='center'?this.width:'100%'}
 ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:this.width=='100%'?this.caption_align:'left'},align:'left',cn:[{tag:'i',contenteditable:Roo.htmleditor.BlockFigure.caption_edit,html:this.caption.length?this.caption:"Caption"}
 ]}]});}return B;},readElement:function(A){this.video_url=this.getVal(A,'div','src');this.cls=this.getVal(A,'div','class');this.href=this.getVal(A,'a','href');this.image_src=this.getVal(A,'img','src');this.align=this.getVal(A,'figure','align');this.caption_display=this.getVal(A,true,'data-caption-display');
-if(this.caption_display==''){this.caption_display=this.getVal(A,'figcaption','data-display');}var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');this.caption_align=this.getVal(B,'div','text-align','style');Roo.log('CAPTION ALIGN');
-Roo.log(this.caption_align);}var dc=this.getVal(A,true,'data-caption');if(this.caption_display=='none'&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true}
-);
+if(this.caption_display==''){this.caption_display=this.getVal(A,'figcaption','data-display');}this.caption_align=this.getValue(A,true,'data-caption-align');var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');}var dc=this.getVal(A,true,'data-caption');
+if(this.caption_display=='none'&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true});
 // Roo/htmleditor/BlockTable.js
 Roo.htmleditor.BlockTable=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);if(!A.node){this.rows=[];for(var r=0;r<this.no_row;r++){this.rows[r]=[];for(var c=0;c<this.no_col;c++){this.rows[r][c]=this.emptyCell();
 }}}};Roo.extend(Roo.htmleditor.BlockTable,Roo.htmleditor.Block,{rows:false,no_col:1,no_row:1,width:'100%',friendly_name:'Table',deleteTitle:'Delete Table',contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode);};var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;
index 5cf25a5..f4ea9b5 100644 (file)
@@ -48647,6 +48647,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
             'data-width' : this.width,
             'data-caption' : this.caption, 
             'data-caption-display' : this.caption_display,
+            'data-caption-align' : this.caption_align,
             contenteditable : 'false',
             
             style : {
@@ -48730,14 +48731,13 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
             this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         }
 
+        this.caption_align = this.getValue(node, true, 'data-caption-align');
+
         // read caption from figcaption
         var figcaption = this.getVal(node, 'figcaption', false);
 
         if (figcaption !== '') {
             this.caption = this.getVal(figcaption, 'i', 'html');
-            this.caption_align = this.getVal(figcaption, 'div', 'text-align', 'style');
-            Roo.log('CAPTION ALIGN');
-            Roo.log(this.caption_align);
         }
                 
 
index 9e589ba..4a957c3 100644 (file)
@@ -24145,6 +24145,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
             'data-width' : this.width,
             'data-caption' : this.caption, 
             'data-caption-display' : this.caption_display,
+            'data-caption-align' : this.caption_align,
             contenteditable : 'false',
             
             style : {
@@ -24228,14 +24229,13 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
             this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         }
 
+        this.caption_align = this.getValue(node, true, 'data-caption-align');
+
         // read caption from figcaption
         var figcaption = this.getVal(node, 'figcaption', false);
 
         if (figcaption !== '') {
             this.caption = this.getVal(figcaption, 'i', 'html');
-            this.caption_align = this.getVal(figcaption, 'div', 'text-align', 'style');
-            Roo.log('CAPTION ALIGN');
-            Roo.log(this.caption_align);
         }
                 
 
index 2dda998..de4ffc8 100644 (file)
@@ -1068,13 +1068,12 @@ this.setPressed(v!='block');},listeners:{toggle:function(F,G){var b=B();b.captio
 A.editorcore.onEditorEvent();}},xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'caption_align',listeners:{render:function(F){A.captionAlign=this;
 },select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode);var b=B();b.caption_align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right']],fields:['val'],xns:Roo.data}}];
 },toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m}
-};if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,'data-caption-display':this.caption_display,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align}
+};if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,'data-caption-display':this.caption_display,'data-caption-align':this.caption_align,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align}
 ,align:this.align,cn:[A]};if(this.caption_display=='block'){B['cn'].push({tag:'figcaption',style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:(this.align=='center'?this.width:'100%')+' !important',margin:m,width:this.align=='center'?this.width:'100%'}
 ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:this.width=='100%'?this.caption_align:'left'},align:'left',cn:[{tag:'i',contenteditable:Roo.htmleditor.BlockFigure.caption_edit,html:this.caption.length?this.caption:"Caption"}
 ]}]});}return B;},readElement:function(A){this.video_url=this.getVal(A,'div','src');this.cls=this.getVal(A,'div','class');this.href=this.getVal(A,'a','href');this.image_src=this.getVal(A,'img','src');this.align=this.getVal(A,'figure','align');this.caption_display=this.getVal(A,true,'data-caption-display');
-if(this.caption_display==''){this.caption_display=this.getVal(A,'figcaption','data-display');}var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');this.caption_align=this.getVal(B,'div','text-align','style');Roo.log('CAPTION ALIGN');
-Roo.log(this.caption_align);}var dc=this.getVal(A,true,'data-caption');if(this.caption_display=='none'&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true}
-);
+if(this.caption_display==''){this.caption_display=this.getVal(A,'figcaption','data-display');}this.caption_align=this.getValue(A,true,'data-caption-align');var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');}var dc=this.getVal(A,true,'data-caption');
+if(this.caption_display=='none'&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true});
 // Roo/htmleditor/BlockTable.js
 Roo.htmleditor.BlockTable=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);if(!A.node){this.rows=[];for(var r=0;r<this.no_row;r++){this.rows[r]=[];for(var c=0;c<this.no_col;c++){this.rows[r][c]=this.emptyCell();
 }}}};Roo.extend(Roo.htmleditor.BlockTable,Roo.htmleditor.Block,{rows:false,no_col:1,no_row:1,width:'100%',friendly_name:'Table',deleteTitle:'Delete Table',contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode);};var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;