[BUGFIX] High CPU load in IE8/9 when using context menu in htmlArea RTE
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 1 Sep 2011 16:55:05 +0000 (12:55 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 1 Sep 2011 18:38:44 +0000 (20:38 +0200)
Cleanup event listeners.

Change-Id: Ic92ef7df49c9b6266e51f6193ec2611ea3431fe3
Resolves: #29361
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/4732
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js

index 8141892..eeaea16 100644 (file)
@@ -90,7 +90,7 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
                        items: this.buildItemsConfig()
                }, this.pageTSConfiguration));
                        // Monitor contextmenu clicks on the iframe
-               this.menu.mon(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this, {single: true});
+               this.menu.mon(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this);
                        // Monitor editor being destroyed
                this.menu.mon(this.editor, 'beforedestroy', this.onBeforeDestroy, this, {single: true});
        },
@@ -161,29 +161,26 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
         * Handler when the menu gets shown
         */
        onShow: function () {
-               this.menu.mun(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this);
                this.menu.mon(Ext.get(this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu, {single: true});
        },
        /*
         * Handler when the menu gets hidden
         */
        onHide: function () {
-               this.menu.mon(Ext.get(this.editor.document.documentElement), 'contextmenu', this.show, this, {single: true});
                this.menu.mun(Ext.get(this.editor.document.documentElement), 'mousedown', this.menu.hide, this.menu);
        },
        /*
         * Handler to show the context menu
         */
        show: function (event, target) {
-                       // Need to wait a while for the toolbar state to be updated
-               this.showMenu.defer(150, this, [event, target]);
                event.stopEvent();
-               return false;
+                       // Need to wait a while for the toolbar state to be updated
+               this.showMenu.defer(150, this, [target]);
        },
        /*
         * Show the context menu
         */
-       showMenu: function (event, target) {
+       showMenu: function (target) {
                this.showContextItems(target);
                if (!Ext.isIE) {
                        this.ranges = this.editor.getSelectionRanges();