Add more keyboard navigation options for inline comments

Summary:
  - Use n/p to jump between comments.
  - Use r to reply to the selected comment.
  - Use e to edit the selected comment.

Test Plan: Verified n, p, r, e, j, k, J, K, "click edit" and "click reply"
behavior in as many weird cases as I could come up with.

Reviewers: btrahan, jungejason, nh, cpiro, jl

Reviewed By: btrahan

CC: aran, btrahan, epriestley

Maniphest Tasks: T583

Differential Revision: https://secure.phabricator.com/D1308
This commit is contained in:
epriestley
2012-01-04 08:21:22 -08:00
parent 275472d70f
commit 1c1fe96bec
3 changed files with 139 additions and 71 deletions

View File

@@ -183,8 +183,13 @@ JX.behavior('differential-edit-inline-comments', function(config) {
});
var action_handler = function(op, e) {
var data = e.getNodeData('differential-inline-comment');
var node = e.getNode('differential-inline-comment');
handle_inline_action(node, op);
e.kill();
}
var handle_inline_action = function(node, op) {
var data = JX.Stratcom.getData(node);
var row = node.parentNode.parentNode;
var original = data.original;
@@ -203,8 +208,6 @@ JX.behavior('differential-edit-inline-comments', function(config) {
.setRow(row)
.setTable(row.parentNode)
.start();
e.kill();
}
for (var op in {'edit' : 1, 'delete' : 1, 'reply' : 1}) {
@@ -214,5 +217,13 @@ JX.behavior('differential-edit-inline-comments', function(config) {
JX.bind(null, action_handler, op));
}
JX.Stratcom.listen(
'differential-inline-action',
null,
function(e) {
var data = e.getData();
handle_inline_action(data.node, data.op);
});
});