Make new DiffInline code handle most "delete" operations

Summary:
Ref T12616. This moves the delete actions to the new, more stateful way of doing things.

These are a little tricky because you can click "Delete" on an inline, but you can also click "Delete" from the preview area at the bottom of the page. If you do, the inline you are deleting may or may not be present on the page.

This has a few bugs -- notably, deleting from the preview without interacting with the on-page inline first won't actually delete the on-page inline yet -- but nothing too serious.

Test Plan: Deleted inlines, undid deletion, deleted from preview.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12616

Differential Revision: https://secure.phabricator.com/D17890
This commit is contained in:
epriestley
2017-05-15 15:03:30 -07:00
parent 3c18cb77fb
commit d97f80bc90
5 changed files with 312 additions and 138 deletions

View File

@@ -322,7 +322,6 @@ JX.install('DiffChangeset', {
return JX.Stratcom.getData(this._node);
},
_onresponse: function(sequence, response) {
if (sequence != this._sequence) {
// If this isn't the most recent request, ignore it. This normally
@@ -420,8 +419,25 @@ JX.install('DiffChangeset', {
}
return data.inline;
},
getInlineByID: function(id) {
// TODO: Currently, this will only find inlines which the user has
// already interacted with! Inlines are built lazily as events arrive.
// This can not yet find inlines which are passively present in the
// document.
for (var ii = 0; ii < this._inlines.length; ii++) {
var inline = this._inlines[ii];
if (inline.getID() == id) {
return inline;
}
}
return null;
}
},
statics: {