fix caption display and pasting
[roojs1] / Roo / htmleditor / BlockFigure.js
index 118457f..c43f0e3 100644 (file)
@@ -311,7 +311,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',
@@ -335,10 +335,10 @@ 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
@@ -346,11 +346,22 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
                     cls : this.cls.length > 0 ? (this.cls  + '-thumbnail' ) : '',
                     cn : [
                         {
-                            // we can not rely on yahoo syndication to use CSS elements - so have to use  '<i>' to encase stuff.
-                            tag : 'i',
-                            contenteditable : true,
-                            html : captionhtml
+                            tag: 'div',
+                            style  : {
+                                'margin-top' : '16px'
+                            },
+                            align: 'left',
+                            cn : [
+                                {
+                                    // we can not rely on yahoo syndication to use CSS elements - so have to use  '<i>' to encase stuff.
+                                    tag : 'i',
+                                    contenteditable : true,
+                                    html : captionhtml
+                                }
+                                
+                            ]
                         }
+                        
                     ]
                     
                 }
@@ -375,7 +386,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');