X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=Roo%2Fhtmleditor%2FBlockFigure.js;h=9f2dc276fbbb8106ff175afcbdb5f03418279881;hp=f27d64a1e74c30def7a951132b1dae3d02bf8bb1;hb=3cc0f894f4950c221efdc268aed5afa04b6971b2;hpb=0a63fb76507fcd1468a87100feb288338db14739 diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index f27d64a1e7..9f2dc276fb 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -263,15 +263,16 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { var m = this.width == '50%' && this.align == 'center' ? '0 auto' : 0; + var iw = this.align == 'center' ? this.width : '100%'; var img = { tag : 'img', contenteditable : 'false', src : this.image_src, alt : d.innerText.replace(/\n/g, " ").replace(/\s+/g, ' ').trim(), // removeHTML and reduce spaces.. style: { - width : 'auto', - 'max-width': '100%', - margin : '0px' + width : iw, + maxWidth : iw + ' !important', // this is not getting rendered? + margin : m } @@ -310,21 +311,23 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { ] }; } - - var captionhtml = this.caption_display == 'hidden' ? this.caption : (this.caption.length ? this.caption : "Caption"); + // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption + var captionhtml = 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' + maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), + width : this.align == 'center' ? '100%' : this.width, + margin: '0px', + padding: '10px', + textAlign : this.align // seems to work for email.. }, @@ -335,22 +338,38 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { { tag: 'figcaption', - + 'data-display' : this.caption_display, style : { - 'text-align': 'left', - 'margin-top' : '16px', - 'font-size' : '16px', - 'line-height' : '24px', - display : this.caption_display + 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 : [ { - // we can not rely on yahoo syndication to use CSS elements - so have to use '' to encase stuff. - tag : 'i', - contenteditable : true, - html : captionhtml + tag: 'div', + style : { + marginTop : '16px', + textAlign : 'left' + }, + align: 'left', + cn : [ + { + // we can not rely on yahoo syndication to use CSS elements - so have to use '' to encase stuff. + tag : 'i', + contenteditable : true, + html : captionhtml + } + + ] } + ] } @@ -370,14 +389,12 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.image_src = this.getVal(node, 'img', 'src'); this.align = this.getVal(node, 'figure', 'align'); - this.caption = this.getVal(node, 'figcaption', 'html'); - // remove ' - if (this.caption.trim().match(/^]*>/i)) { - this.caption = this.caption.trim().replace(/^]*>/i, '').replace(/^<\/i>$/i, ''); - } - this.caption_display = this.getVal(node, 'figcaption', 'style', 'display'); + var figcaption = this.getVal(node, 'figcaption', false); + this.caption = this.getVal(figcaption, 'i', 'html'); + + 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.width = this.getVal(node, 'figcaption', 'style', 'width'); //this.margin = this.getVal(node, 'figure', 'style', 'margin'); },