Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#6633 closed Bug (invalid)

No events after setData

Reported by: Matthias Owned by:
Priority: Normal Milestone:
Component: General Version: 3.4.1
Keywords: Cc: karthick.ajk@…


After you set the editor data via editor.setData(html) no more (key) events are fired on the body.

Example Code:

editor.document.getBody().on("keyup", function() {

alert("keyup event");

}); editor.setData("...");

After that, the keyup event will never be fired again. Maybe the editor creates a complete new body when calling setData (which implicitly removes the listeners)?

Change History (3)

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

Resolution: invalid
Status: newclosed

Yes, a new document is created when setData is used and you must re-attach any listeners that you applied to the document or its contents.

comment:2 Changed 8 years ago by Karthik Jayapal

Cc: karthick.ajk@… added

But when do i re-attach the events? Is there an event fired after the setData is complete?

comment:3 Changed 6 years ago by bmulholland

To help future searchers: I found the answer at

In particular, you attach on listeners the contentDom event, but you must also detach the listeners on contentDomUnload so that the new listeners work each time.

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