0

I have a form panel with an htmleditor (Ext.form.field.HtmlEditorView). The editor works fine, but I can't register plugins on it. The plugin from the code below never gets initialized.

Im using ExtJs 4.2

The plugin code:

Ext.define('Ext.ux.wysiwyg.Filemanager', {
    alias: 'plugin.filemanager',

    init: function(cmp){
        console.log('init'); //Never gets initialized!
    }
});

And here is how I register the plugin on the htmleditor:

xtype: 'htmleditor',
plugins: [
    Ext.create('Ext.ux.wysiwyg.Filemanager')
]

So my question: how can I get a plugin on the htmleditor?

Lauren Zonneveld
  • 683
  • 5
  • 15

1 Answers1

0

Try the following sample code, it worked for me.

It is taken from Extjs 4.2 docs, you can also test it there in the code editor / live preview.

Code:

Ext.define('Ext.ux.wysiwyg.Filemanager', {
    alias: 'plugin.filemanager',

    init: function(cmp){
       alert( cmp.xtype ); // says "htmleditor"
    }
});

new Ext.panel.Panel({
    title: 'HTML Editor',
    renderTo: Ext.getBody(),
    width: 550,
    height: 250,
    frame: true,
    layout: 'fit',
    items: {
        xtype: 'htmleditor',
        enableColors: false,
        enableAlignments: false,
        plugins: [
    Ext.create('Ext.ux.wysiwyg.Filemanager')
     ]
    }
});
Shlomo
  • 3,880
  • 8
  • 50
  • 82
  • You are adding a plugin on the panel. I want to add a plugin on the htmleditor. `cmp` should be the htmleditor object. – Lauren Zonneveld Aug 14 '13 at 17:51
  • Yes sorry, now it works also when adding to the `htmleditor`. `cmp.xtype` in the `init()` says `htmleditor`. See edit. – Shlomo Aug 15 '13 at 08:31