Don't discard inline comments when escape key is pressed

When editing an inline comment on a patch set, pressing the escape key
causes the edits to be discarded.  This can be frustrating if the key
is accidentally pressed.

This change removes the handling of the escape key in the inline comment
editor panel, so nothing happens when it is pressed.

To discard edits, the user must now explicitly click the "Discard"
button on the panel.

Bug: Issue 1848
Change-Id: I115e6aa9ba6a272cf4ad24257c36eb318163b8ab
This commit is contained in:
David Pursehouse
2013-04-05 09:34:13 +09:00
parent b1dadd2cc2
commit 17bbd9ad06

View File

@@ -81,18 +81,6 @@ public class CommentEditorPanel extends CommentPanel implements ClickHandler,
text.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(final KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE
&& !event.isAnyModifierKeyDown()) {
event.preventDefault();
if (isNew()) {
onDiscard();
} else {
render();
}
return;
}
if ((event.isControlKeyDown() || event.isMetaKeyDown())
&& !event.isAltKeyDown() && !event.isShiftKeyDown()) {
switch (event.getNativeKeyCode()) {