Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5883 closed Bug (invalid)

event.editor undefined for "keyup" event

Reported by: Nikola Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description (last modified by Frederico Caldeira Knabben)

Inside the keyup event, the event object contains an editor, but it is undefined.

By not making the editor available, it renders the keyup event useless in cases where there may be variable numbers of editors on the page, and we do not know the editors names ahead of time.

Here is an example. In this case, we assume that this chunk of code is contained inside a loop, and until run-time, we do not know the value of "id".

CKEDITOR.instances[id].on("instanceReady", function(event)
{
  //set keyup event
  alert(event.editor.name) //this correctly gives me the name
  this.document.on("keyup", function(event)
  {
    alert(event.editor.name);  //this throws an error, as the editor is undefined. 
  });
});

Change History (2)

comment:1 Changed 14 years ago by Frederico Caldeira Knabben

Resolution: invalid
Status: newclosed

Please note that, even if "this.document" is a property relative to an editor instance, it points to the CKEDITOR.dom.document class, which is a generic class for DOM manipulation, which is not related to editor instances. It'll never have the instance information on it.

In the above sample case, it's enough to simply cache the editor instance into a local variable in the "instanceReady" event handler, pointing to it later inside the "keyup" event. That's the right way for it.

comment:2 Changed 14 years ago by Frederico Caldeira Knabben

Description: modified (diff)
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