From: Alan Date: Tue, 1 Mar 2022 04:08:44 +0000 (+0800) Subject: fix caption display and pasting X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=1cd595bec434710d4a42891c9da7b98667c137d9 fix caption display and pasting --- diff --git a/docs/src/Roo_htmleditor_BlockFigure.js.html b/docs/src/Roo_htmleditor_BlockFigure.js.html index eb95d8497a..c6fffffe7f 100644 --- a/docs/src/Roo_htmleditor_BlockFigure.js.html +++ b/docs/src/Roo_htmleditor_BlockFigure.js.html @@ -326,7 +326,8 @@ maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: '10px' + padding: '10px', + textAlign : this.align // seems to work for email.. }, @@ -354,7 +355,8 @@ { tag: 'div', style : { - 'margin-top' : '16px' + marginTop : '16px', + textAlign : 'left' }, align: 'left', cn : [ diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index d2cf422502..9cca7ea61b 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -27299,7 +27299,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: '10px' + padding: '10px', + textAlign : this.align // seems to work for email.. }, @@ -27327,7 +27328,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { { tag: 'div', style : { - 'margin-top' : '16px' + marginTop : '16px', + textAlign : 'left' }, align: 'left', cn : [ diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 10ff1eca5e..7da1550d5d 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1184,8 +1184,8 @@ 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 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=this.caption_display=='none'?'':(this.caption.length?this.caption:"Caption"); -return {tag:'figure','data-block':'Figure',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:'10px'} -,align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:this.width+' !important',margin:m,width:this.width},cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{'margin-top':'16px'} +return {tag:'figure','data-block':'Figure',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:'10px',textAlign:this.align} +,align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:this.width+' !important',margin:m,width:this.width},cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'} ,align:'left',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'); var B=this.getVal(A,'figcaption',false);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','width');},removeNode:function(){return this.node;}}) // Roo/htmleditor/BlockTable.js