Use an inline dialog element for inline comments in Differential

Summary:
The current approach of using a modal overlay dialog to create/edit inline
comments is pretty silly. Use an inline textarea instead.

This element isn't perfect and we have some mild modalness issues, but I think
it's better than the silly thing we've got going on right now. We can keep
poking it as people break it.

Test Plan:
  - Created comments; submitted and undid them in empty and nonempty states.
Used undo for nonempty states + cancel.
  - Edited comments; saved and canceled them. Used undo for changed state.
  - Replied to comments; yada yada as above.
  - Deleted comments.
  - Did various modal trickery where I clicked "Reply" on something else with a
dialog already up, this very mildly glitches but I think it's not a big issue.

Reviewers: vrana, btrahan, Makinde, nh

Reviewed By: vrana

CC: aran, epriestley

Maniphest Tasks: T431

Differential Revision: https://secure.phabricator.com/D1716
This commit is contained in:
epriestley
2012-02-29 14:28:48 -08:00
parent fe7e991b55
commit 21f0aba701
11 changed files with 375 additions and 87 deletions

View File

@@ -50,6 +50,7 @@ JX.behavior('differential-edit-inline-comments', function(config) {
selecting = false;
editor = false;
hideReticle();
set_link_state(false);
});
function isOnRight(node) {
@@ -69,6 +70,10 @@ JX.behavior('differential-edit-inline-comments', function(config) {
}
}
var set_link_state = function(active) {
JX.DOM.alterClass(JX.$(config.stage), 'inline-editor-active', active);
};
JX.Stratcom.listen(
'mousedown',
['differential-changeset', 'tag:th'],
@@ -148,6 +153,8 @@ JX.behavior('differential-edit-inline-comments', function(config) {
.setTable(insert.parentNode)
.start();
set_link_state(true);
e.kill();
});
@@ -183,9 +190,14 @@ JX.behavior('differential-edit-inline-comments', function(config) {
});
var action_handler = function(op, e) {
e.kill();
if (editor) {
return;
}
var node = e.getNode('differential-inline-comment');
handle_inline_action(node, op);
e.kill();
}
var handle_inline_action = function(node, op) {
@@ -208,6 +220,8 @@ JX.behavior('differential-edit-inline-comments', function(config) {
.setRow(row)
.setTable(row.parentNode)
.start();
set_link_state(true);
}
for (var op in {'edit' : 1, 'delete' : 1, 'reply' : 1}) {