sync
authorAlan <alan@roojs.com>
Tue, 28 Sep 2021 08:40:09 +0000 (16:40 +0800)
committerAlan <alan@roojs.com>
Tue, 28 Sep 2021 08:40:09 +0000 (16:40 +0800)
Roo/HtmlEditorCore.js
Roo/htmleditor/BlockFigure.js

index 4671397..f25bd8c 100644 (file)
@@ -332,6 +332,10 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         if(this.initialized){
             var bd = (this.doc.body || this.doc.documentElement);
             //this.cleanUpPaste(); -- this is done else where and causes havoc..
+            
+            // remove content editable. (blocks)
+            new Roo.htmleditor.FilterAttribute({node : bd, attrib_black: [ 'contenteditable' ] });
+            
             var html = bd.innerHTML;
             if(Roo.isSafari){
                 var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!
index 8a7216f..1c9ff61 100644 (file)
@@ -8,10 +8,10 @@
     
     usage:
      -- add to document..
-     new Roo.htmleditor.BlockFigure{
+    new Roo.htmleditor.BlockFigure{
         image_src : 'http://www.google.com',
         caption : 'test',
-     }
+    }
      -- load document, and search for elements of this...
     Roo.DomQuery.select('*[data-block])
     // loop each and call ctor ({node : xxx})
@@ -42,6 +42,8 @@ Roo.htmleditor.BlockFigure.prototype = {
     image_width : '',
     image_height : '',
     
+    // used by context menu
+    
     context : { // ?? static really
         image_width : {
             title: "Width",
@@ -72,7 +74,10 @@ Roo.htmleditor.BlockFigure.prototype = {
             width: 220
         }
     },
-    
+    /**
+     * create a DomHelper friendly object - for use with
+     * Roo.DomHelper.markup / overwrite / etc..
+     */
     toObject : function()
     {
         
@@ -96,7 +101,6 @@ Roo.htmleditor.BlockFigure.prototype = {
                 img,
                 {
                     tag: 'figcaption',
-                    'data-name' : 'caption',
                     contenteditable : true,
                     style : 'text-align:left',
                     html : this.caption 
@@ -104,6 +108,7 @@ Roo.htmleditor.BlockFigure.prototype = {
             ]
         };
     },
+    
     readElement : function(node)
     {
         this.image_src = this.getVal(node, 'img', 'src');
@@ -115,7 +120,10 @@ Roo.htmleditor.BlockFigure.prototype = {
     updateElement : function(node)
     {
         Roo.DomHelper.overwrite(node, this.toObject());
-
+    },
+    toHTML : function()
+    {
+        Roo.DomHelper.markup(this.toObject());
     },
     
     getVal : function(node, tag, attr, style)