X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fhtmleditor%2FBlockFigure.js;h=6c5028290d006000354d9450c1cbce17ca19dbfc;hb=a10bb9e00b52284dbebfa6db54c1f44500c210bd;hp=230623764325641d10e3d85bf2b0d750213d2604;hpb=b969a627b10d8f6cc39466748ae28f50f97aba3b;p=roojs1 diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index 2306237643..6c5028290d 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -179,6 +179,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { data : [ ['auto'], ['50%'], + ['80%'], ['100%'] ], fields : [ 'val'], @@ -233,7 +234,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -261,7 +265,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { var d = document.createElement('div'); d.innerHTML = this.caption; - var m = this.width == '50%' && this.align == 'center' ? '0 auto' : 0; + var m = this.width != '100%' && this.align == 'center' ? '0 auto' : 0; var iw = this.align == 'center' ? this.width : '100%'; var img = { @@ -272,8 +276,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { style: { width : iw, maxWidth : iw + ' !important', // this is not getting rendered? - margin : m - + margin : m } }; @@ -314,7 +317,8 @@ 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 == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -326,7 +330,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: this.align == 'center' ? '0' : '0 10px' , + textAlign : this.align // seems to work for email.. }, @@ -354,7 +359,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { { tag: 'div', style : { - 'margin-top' : '16px' + marginTop : '16px', + textAlign : 'left' }, align: 'left', cn : [ @@ -373,6 +379,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } ] }; + return ret; }, @@ -388,7 +395,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.align = this.getVal(node, 'figure', 'align'); var figcaption = this.getVal(node, 'figcaption', false); - this.caption = this.getVal(figcaption, 'i', 'html'); + if (figcaption !== '') { + 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');