#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 )
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 15 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 15 years ago by
Description: | modified (diff) |
---|
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.