Wikia/app — pull request #728 by kflorence (2013-04-30 00:32:14+00:00)
Title: BugId 95972

https://wikia.fogbugz.com/default.asp?95972

Turns out the keyup event was bound in the wrong place which caused problems because of a race condition that would intermittently fail. The editor environment is very complex because there are about six different modes it can operate in, so the generally preferred way of handling events is by adding them into the WikiaEditor object which provides similar interfaces for both the CKEditor and the MediaWiki editor. I went ahead and added a keyUp event there that we can listen to.

Along the way I fixed a few other small issues:

* You could enter one character of text, then delete it, then submit, so I added a check to make sure the editor actually had content before the buttons would be enabled. After doing that I discovered that the events for adding media were being fired too early (before the content was actually inserted) and were a bit redundant (because we want to do the same thing for all media types) so I created a single event called 'editorAddMedia' and put it in a place where we can actually catch if content has been added or not.

* There was a mismatch in data keys used by the RTEOverlayNode ('editor' and 'wikiaEditor') that was causing "TypeError: Cannot call method 'setAsActiveInstance' of undefined"