fix caption on hidden figures
[roojs1] / roojs-bootstrap-debug.js
index c03f007..3f835e4 100644 (file)
@@ -29425,7 +29425,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         var ret =   {
             tag: 'figure',
             'data-block' : 'Figure',
-            'data-width' : this.width, 
+            'data-width' : this.width,
+            'data-caption' : this.caption, 
             contenteditable : 'false',
             
             style : {
@@ -29498,6 +29499,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         this.image_src = this.getVal(node, 'img', 'src');
          
         this.align = this.getVal(node, 'figure', 'align');
+        
+        /// not really used - as hidden captions do not store the content here..
         var figcaption = this.getVal(node, 'figcaption', false);
         if (figcaption !== '') {
             this.caption = this.getVal(figcaption, 'i', 'html');
@@ -29505,6 +29508,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, {
         
 
         this.caption_display = this.getVal(node, 'figcaption', 'data-display');
+        var dc = this.getVal(node, 'figcaption', 'data-caption');
+        if (dc && dc.length) {
+            this.caption = dc;
+        }
         //this.text_align = this.getVal(node, 'figcaption', 'style','text-align');
         this.width = this.getVal(node, true, 'data-width');
         //this.margin = this.getVal(node, 'figure', 'style', 'margin');
@@ -31374,8 +31381,8 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         var cd = (e.browserEvent.clipboardData || window.clipboardData);
         
         // check what type of paste - if it's an image, then handle it differently.
-        if (cd.files && cd.files.length > 0) {
-            // pasting images?
+        if (cd.files && cd.files.length > 0 && cd.types.indexOf('text/html') < 0) {
+            // pasting images? 
             var urlAPI = (window.createObjectURL && window) || 
                 (window.URL && URL.revokeObjectURL && URL) || 
                 (window.webkitURL && webkitURL);
@@ -33134,6 +33141,7 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
   
         if (!far.length) {
             if (fire_add) {
+                this.editor.syncValue();
                 editor.owner.fireEvent('editorevent', editor.owner, false);
                 editor.owner.fireEvent('imageadd', editor.owner, false);
             }
@@ -33158,6 +33166,7 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
                 bl.image_src = reader.result;
                 //bl.caption = f.name;
                 bl.updateElement(sn);
+                this.editor.syncValue();
                 editor.owner.fireEvent('editorevent', editor.owner, false);
                 editor.owner.fireEvent('imageupdate', editor.owner, sn);
                 // we only do the first file!! and replace.
@@ -33176,6 +33185,7 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
             // just a standard img..
             if (sn && sn.tagName.toUpperCase() == 'IMG') {
                 sn.src = reader.result;
+                this.editor.syncValue();
                 editor.owner.fireEvent('editorevent', editor.owner, false);
                 editor.owner.fireEvent('imageupdate', editor.owner, sn);
                 return;
@@ -33348,6 +33358,7 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
                 selection.addRange(range);
                 this.updateToolbar(null, null, null);
                 if (sn.tagName.toUpperCase() == 'FIGURE') {
+                    this.editor.syncValue();
                     this.editor.fireEvent('imagedelete', this.editor, sn);
                 }
                 
@@ -33372,6 +33383,7 @@ Roo.extend(Roo.bootstrap.form.HtmlEditorToolbar.Standard, Roo.bootstrap.nav.Simp
         selection.removeAllRanges();
         selection.addRange(range);
         if (sn.tagName.toUpperCase() == 'IMG"') {
+            this.editor.syncValue();
             this.editor.fireEvent('imagedelete', this.editor, sn);
         }