fix caption display
authorAlan <alan@roojs.com>
Wed, 23 Feb 2022 10:12:38 +0000 (18:12 +0800)
committerAlan <alan@roojs.com>
Wed, 23 Feb 2022 10:12:38 +0000 (18:12 +0800)
Roo/htmleditor/BlockFigure.js
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 118457f..233eec4 100644 (file)
@@ -335,7 +335,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
               
                 {
                     tag: 'figcaption',
-                    
+                    'data-display' : this.caption_display,
                     style : {
                         'text-align': 'left',
                         'margin-top' : '16px',
@@ -375,7 +375,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         if (this.caption.trim().match(/^<i[^>]*>/i)) {
             this.caption = this.caption.trim().replace(/^<i[^>]*>/i, '').replace(/^<\/i>$/i, '');
         }
-        this.caption_display = this.getVal(node, 'figcaption', 'style', 'display');
+        this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         //this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
         this.width = this.getVal(node, 'figure', 'style', 'max-width');
         //this.margin = this.getVal(node, 'figure', 'style', 'margin');
index f9368c6..92b000f 100644 (file)
@@ -1994,9 +1994,9 @@ var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent(
 },listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent();
 }},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width=='50%'&&this.align=='center'?'0 auto':0;var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:'auto','max-width':'100%',margin:'0px'}
 };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=this.caption_display=='hidden'?'':(this.caption.length?this.caption:"Caption");
-return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'},align:this.align,cn:[A,{tag:'figcaption',style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px',display:this.caption_display}
+return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'},align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px',display:this.caption_display}
 ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'i',contenteditable:true,html: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=this.getVal(A,'figcaption','html');if(this.caption.trim().match(/^<i[^>]*>/i)){this.caption=this.caption.trim().replace(/^<i[^>]*>/i,'').replace(/^<\/i>$/i,'');}this.caption_display=this.getVal(A,'figcaption','style','display');
+this.align=this.getVal(A,'figure','align');this.caption=this.getVal(A,'figcaption','html');if(this.caption.trim().match(/^<i[^>]*>/i)){this.caption=this.caption.trim().replace(/^<i[^>]*>/i,'').replace(/^<\/i>$/i,'');}this.caption_display=this.getVal(A,'figcaption','data-display');
 this.width=this.getVal(A,'figure','style','max-width');},removeNode:function(){return this.node;}})
 // 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();
index a90bce8..2828310 100644 (file)
@@ -48142,7 +48142,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
               
                 {
                     tag: 'figcaption',
-                    
+                    'data-display' : this.caption_display,
                     style : {
                         'text-align': 'left',
                         'margin-top' : '16px',
@@ -48182,7 +48182,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         if (this.caption.trim().match(/^<i[^>]*>/i)) {
             this.caption = this.caption.trim().replace(/^<i[^>]*>/i, '').replace(/^<\/i>$/i, '');
         }
-        this.caption_display = this.getVal(node, 'figcaption', 'style', 'display');
+        this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         //this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
         this.width = this.getVal(node, 'figure', 'style', 'max-width');
         //this.margin = this.getVal(node, 'figure', 'style', 'margin');
index 8f12976..b317fe9 100644 (file)
@@ -23673,7 +23673,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
               
                 {
                     tag: 'figcaption',
-                    
+                    'data-display' : this.caption_display,
                     style : {
                         'text-align': 'left',
                         'margin-top' : '16px',
@@ -23713,7 +23713,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         if (this.caption.trim().match(/^<i[^>]*>/i)) {
             this.caption = this.caption.trim().replace(/^<i[^>]*>/i, '').replace(/^<\/i>$/i, '');
         }
-        this.caption_display = this.getVal(node, 'figcaption', 'style', 'display');
+        this.caption_display = this.getVal(node, 'figcaption', 'data-display');
         //this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
         this.width = this.getVal(node, 'figure', 'style', 'max-width');
         //this.margin = this.getVal(node, 'figure', 'style', 'margin');
index d5094cc..61d6f8b 100644 (file)
@@ -1049,9 +1049,9 @@ var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent(
 },listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent();
 }},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width=='50%'&&this.align=='center'?'0 auto':0;var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:'auto','max-width':'100%',margin:'0px'}
 };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=this.caption_display=='hidden'?'':(this.caption.length?this.caption:"Caption");
-return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'},align:this.align,cn:[A,{tag:'figcaption',style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px',display:this.caption_display}
+return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'},align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px',display:this.caption_display}
 ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'i',contenteditable:true,html: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=this.getVal(A,'figcaption','html');if(this.caption.trim().match(/^<i[^>]*>/i)){this.caption=this.caption.trim().replace(/^<i[^>]*>/i,'').replace(/^<\/i>$/i,'');}this.caption_display=this.getVal(A,'figcaption','style','display');
+this.align=this.getVal(A,'figure','align');this.caption=this.getVal(A,'figcaption','html');if(this.caption.trim().match(/^<i[^>]*>/i)){this.caption=this.caption.trim().replace(/^<i[^>]*>/i,'').replace(/^<\/i>$/i,'');}this.caption_display=this.getVal(A,'figcaption','data-display');
 this.width=this.getVal(A,'figure','style','max-width');},removeNode:function(){return this.node;}})
 // 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();