Roo/form/HtmlEditor/ToolbarContext.js
authorAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:30:09 +0000 (17:30 +0800)
committerAlan <alan@roojs.com>
Wed, 29 Sep 2021 09:30:09 +0000 (17:30 +0800)
Roo/form/HtmlEditor/ToolbarContext.js

index 4f66a7f..b76715a 100644 (file)
@@ -613,7 +613,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
         }
         
         var tbc = Roo.form.HtmlEditor.ToolbarContext;
-        var tbops = tbc.options;
+        
         
         for (var i in tlist) {
             
@@ -623,8 +623,8 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             
             //optname == used so you can configure the options available..
             var opts = item.opts ? item.opts : false;
-            if (item.optname) {
-                opts = tbops[item.optname];
+            if (item.optname) { // use the b
+                opts = Roo.form.HtmlEditor.ToolbarContext.options[item.optname];
            
             }
             
@@ -637,8 +637,10 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                         data : opts  
                     }),
                     name : '-roo-edit-' + i,
+                    
                     attrname : i,
                     stylename : item.style ? item.style : false,
+                    
                     displayField: item.displayField ? item.displayField : 'val',
                     valueField :  'val',
                     typeAhead: false,
@@ -650,6 +652,13 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
                     width: item.width ? item.width  : 130,
                     listeners : {
                         'select': function(c, r, i) {
+                            if (tb.selectedNode.hasClass('data-block')) {
+                                var b = Roo.htmleditor.Block.factory(tb.selectedNode);
+                                b[c.attrname] = r.get('val');
+                                b.updateElement(tb.selectedNode);
+                                return;
+                            }
+                            
                             if (c.stylename) {
                                 tb.selectedNode.style[c.stylename] =  r.get('val');
                                 return;