Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#6633 closed Bug (invalid)

No events after setData

Reported by: mbraun 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 7 years ago by alfonsoml

  • Resolution set to invalid
  • Status changed from new to closed

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 6 years ago by karthikj

  • 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 4 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 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy