diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ 'core.pkg.js' => '1e667bcb', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => 'd71d4531', - 'differential.pkg.js' => '30307170', + 'differential.pkg.js' => '5be7941a', 'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.js' => 'a98c0bf7', 'maniphest.pkg.css' => '35995d6d', @@ -381,7 +381,7 @@ 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 'rsrc/js/application/diff/DiffChangeset.js' => '700bf848', 'rsrc/js/application/diff/DiffChangesetList.js' => '6e668c5b', - 'rsrc/js/application/diff/DiffInline.js' => 'db754a7b', + 'rsrc/js/application/diff/DiffInline.js' => '9a3963e0', 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', @@ -776,7 +776,7 @@ 'phabricator-dashboard-css' => '5a205b9d', 'phabricator-diff-changeset' => '700bf848', 'phabricator-diff-changeset-list' => '6e668c5b', - 'phabricator-diff-inline' => 'db754a7b', + 'phabricator-diff-inline' => '9a3963e0', 'phabricator-diff-path-view' => '8207abf9', 'phabricator-diff-tree-view' => '5d83623b', 'phabricator-drag-and-drop-file-upload' => '4370900d', @@ -1808,6 +1808,9 @@ 'javelin-request', 'javelin-router', ), + '9a3963e0' => array( + 'javelin-dom', + ), '9aae2b66' => array( 'javelin-install', 'javelin-util', @@ -2117,9 +2120,6 @@ 'javelin-uri', 'phabricator-notification', ), - 'db754a7b' => array( - 'javelin-dom', - ), 'e150bd50' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -438,12 +438,6 @@ op = 'delete'; } - // If there's an existing "unedit" undo element, remove it. - if (this._undoRow) { - JX.DOM.remove(this._undoRow); - this._undoRow = null; - } - var data = this._newRequestData(op); this.setLoading(true); @@ -540,7 +534,23 @@ }, _ondeleteresponse: function() { - this._drawUndeleteRows(); + // If there's an existing "unedit" undo element, remove it. + if (this._undoRow) { + JX.DOM.remove(this._undoRow); + this._undoRow = null; + } + + // If there's an existing editor, remove it. This happens when you + // delete a comment from the comment preview area. In this case, we + // read and preserve the text so "Undo" restores it. + var text; + if (this._editRow) { + text = this._readText(this._editRow); + JX.DOM.remove(this._editRow); + this._editRow = null; + } + + this._drawUndeleteRows(text); this.setLoading(false); this.setDeleted(true); @@ -548,9 +558,9 @@ this._didUpdate(); }, - _drawUndeleteRows: function() { + _drawUndeleteRows: function(text) { this._undoType = 'undelete'; - this._undoText = null; + this._undoText = text || null; return this._drawUndoRows('undelete', this._row); }, @@ -649,7 +659,6 @@ }, undo: function() { - JX.DOM.remove(this._undoRow); this._undoRow = null; @@ -666,10 +675,9 @@ .send(); } - if (this._undoType === 'unedit') { + if (this._undoText !== null) { this.edit(this._undoText); } - }, _onundelete: function() {