Use CodeMirror's "change" event to trigger comment model changes.

Review Request #5397 — Created Feb. 4, 2014 and submitted


Review Board


Use CodeMirror's "change" event to trigger comment model changes.

The CommentDialogView was listening to keydown/keyup directly to determine when
to set the "text" property in the model. This worked most of the time, but
meant that if someone used the context menu clipboard operations, it wouldn't
think a change had occurred.

CodeMirror has a "change" event which handles all of these cases. I've plumbed
this through, which both fixes the bug and simplifies the code quite a bit.

While I was doing this, I noticed that closing the dialog caused an infinite
recursion with _.super (which the browser helpfully detected and gave an
error). The issue seemed to be that TextBasedCommentBlockView used _.super to
call 'remove', but AbstractCommentBlockView didn't define a remove method. I've
switched this over to using the prototype instead, which prevents the warning.

Tried making changes to comments by typing stuff, and by using the context-menu
cut and paste operations. Saw that all such changes caused the "Save" button to
become sensitive.

  1. Ship It!

Review request changed
Change Summary:
Pushed to master (1b05b69).