Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1608 closed Bug (fixed)

RegisterDoubleClickHandler overwrites

Reported by: Brian Klug Owned by:
Priority: Normal Milestone: FCKeditor 2.6
Component: General Version:
Keywords: HasPatch Cc:

Description

Problem: When you call RegisterDoubleClickHandler for a certain tag, i.e. IMG, the new handler will overwrite the old one in all cases. Desired behavior: Both old and new handlers will get called.

Example: Let's say you have a handler that checks to see if the IMG tag is of class "x". If so, it will alert(1) when you click on an image with CSS class of "x". But if you register a new handler for IMG, say for example one that is for class of "y" - this will overwrite the handler for IMG's with class "x" and the alert will not get called.

Proposed patch:

Replace the existing RegisterDoubleClickHandler with this function:

// Register objects that can handle double click operations.
FCK.RegisterDoubleClickHandler = function( handlerFunction, tag )
{
  if (FCK.RegisteredDoubleClickHandlers[tag.toUpperCase()])
  {
    var oldfunction = FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ];
    FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = function(arg)
    {
      oldfunction(arg);
      handlerFunction(arg);
    }
    return;
  }
  FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = handlerFunction;
}

Moved from http://sourceforge.net/tracker/index.php?func=detail&aid=1618399&group_id=75348&atid=543655

Change History (3)

comment:1 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Reporter: changed from Alfonso Martínez de Lizarrondo to Brian Klug

comment:2 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Milestone: FCKeditor 2.6
Resolution: fixed
Status: newclosed

Fixed in #1608

comment:3 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy