From: Alan Date: Wed, 23 Feb 2022 10:22:38 +0000 (+0800) Subject: fix caption display X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=ba2c4ec9e232986544417432b0530f8607779c19 fix caption display --- diff --git a/docs/src/Roo_htmleditor_BlockFigure.js.html b/docs/src/Roo_htmleditor_BlockFigure.js.html index 0cb7763ed5..1bd84f5fee 100644 --- a/docs/src/Roo_htmleditor_BlockFigure.js.html +++ b/docs/src/Roo_htmleditor_BlockFigure.js.html @@ -311,7 +311,7 @@ }; } // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption - var captionhtml = this.caption_display == 'hidden' ? '' : (this.caption.length ? this.caption : "Caption"); + var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); return { tag: 'figure', diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 217119f2a3..abbfdf5a7a 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -27281,7 +27281,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { }; } // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption - var captionhtml = this.caption_display == 'hidden' ? '' : (this.caption.length ? this.caption : "Caption"); + var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); return { tag: 'figure', diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index bb8e40d4b2..1fa6943c90 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1183,7 +1183,7 @@ var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent( var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right'],['center']],fields:['val'],xns:Roo.data}},{xtype:'Button',text:'Hide Caption',name:'caption_display',pressed:false,enableToggle:true,setValue:function(v){this.toggle(v=='block'?false:true); },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"); +};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=='none'?'':(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','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)){this.caption=this.caption.trim().replace(/^]*>/i,'').replace(/^<\/i>$/i,'');}this.caption_display=this.getVal(A,'figcaption','data-display');