Sha256: 96e6385ca58d1c80a5dc3fe99917c44275069eed049eb97f8d376d3ffe221eb7

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

Ext.ns('Rwiki');

/**
 * Custom button implementation.
 * @see http://tdg-i.com/535/quicktip-prevent-ext-js-buttons-from-stealing-focus
 */
Rwiki.Button = Ext.extend(Ext.Button, {

  constructor: function() {
    Rwiki.Button.superclass.constructor.apply(this, arguments);
  },

  onMouseDown: function(e) {
    if (!this.disabled && e.button === 0) {
      e.stopEvent(); // injected line here
      this.getClickEl(e).addClass('x-btn-click');
      this.doc.on('mouseup', this.onMouseUp, this);
    }
  },

  onMouseUp: function(e) {
    if (e.button === 0) {
      e.stopEvent(); // injected line here
      this.getClickEl(e, true).removeClass('x-btn-click');
      this.doc.un('mouseup', this.onMouseUp, this);
    }
  }

});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rwiki-0.2.5 public/javascripts/Rwiki/Button.js