Pages

Wednesday, July 18, 2012

How to capture the HTMLEditor's onpaste event

The key to capturing the onpaste event for the HTMLEditor component is to wait for its initialize event to fire and then add the onpaste handler to its document body:


{
xtype: 'htmleditor',
listeners: {
  initialize: function(cmp) {

    Ext.EventManager.addListener(

      cmp.iframeEl.dom.contentWindow.document.body

      , 'paste'

      , function(e, elem){
          console.log(arguments);
      });

    }
  }
}

1 comment:

  1. Hi I like your blog, it's very informative.

    But can please you change your blog template or chose another color for the red links.

    Greetz,
    Melad

    ReplyDelete