Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#11417 closed Bug (fixed)

Doubleclick event (documented) can never work

Reported by: xmo Owned by:
Priority: Normal Milestone: CKEditor 4.3.3
Component: UI : Widgets Version: 4.3.1
Keywords: Cc:

Description

  • Create trivial widget, hook doubleclick event to some operation (e.g. console.log)
  • Open editor
  • Double click widget

Expected: see operation execute Observed: nothing happens

Internally (in setupWidget) the widgets plugin hooks into doubleclick to trigger edit (by calling widget.edit()), then cancels the event leading to further event handlers being ignored.

As a result, listening to doubleclick will never have any effect unless removeAllListeners is invoked beforehand, which is obviously a terrible idea.

Possible solutions:

  • make the handling of doubleclick customisable somehow
  • remove doubleclick from widget's documentation and document edit as firing on double click
  • ???

Change History (5)

comment:1 Changed 11 years ago by Piotrek Koszuliński

It's always possible to do something with event, even if it's cancelled. You just need to add a listener with higher priority. For example:

widget.on( 'doubleclick', function() {
    console.log( 'doubleclick' );
}, null, null, 0 );

The standard priority is 10.

However, I don't know why this event is cancelled now. It makes it harder to do something after doubleclick. Manual and automated tests seem to pass without cancelling, so there's a big chance that we'll fix this.

comment:2 Changed 11 years ago by xmo

Good point, thanks, I'd missed that. Still, not exactly obvious when you're trying to find out why your even does not fire (and the doc only says that the event is available).

comment:3 Changed 11 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.3
Resolution: fixed
Status: newclosed

I couldn't find any reason why it was cancelled, so I fixed it with git:c017cf5.

comment:4 Changed 11 years ago by Piotrek Koszuliński

Summary: doubleclick event (documented) can never workDoubleclick event (documented) can never work

comment:5 Changed 10 years ago by Piotrek Koszuliński

Unfortunately there was a reason why this event was cancelled and why was cancelling editor#doubleclick on widget.wrapper. See #12140. We will partially revert git:c017cf5.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy