diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 453b1d3583..94b8416686 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '632fb8f5', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => '2d70b7b9', - 'differential.pkg.js' => '4d375e61', + 'differential.pkg.js' => 'e6da9e6f', 'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.js' => 'a98c0bf7', 'maniphest.pkg.css' => '35995d6d', @@ -381,7 +381,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 'rsrc/js/application/diff/DiffChangeset.js' => 'a49dc31e', 'rsrc/js/application/diff/DiffChangesetList.js' => '6992b85c', - 'rsrc/js/application/diff/DiffInline.js' => 'a39fd98e', + 'rsrc/js/application/diff/DiffInline.js' => 'e6b9b4f3', 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', @@ -778,7 +778,7 @@ return array( 'phabricator-dashboard-css' => '5a205b9d', 'phabricator-diff-changeset' => 'a49dc31e', 'phabricator-diff-changeset-list' => '6992b85c', - 'phabricator-diff-inline' => 'a39fd98e', + 'phabricator-diff-inline' => 'e6b9b4f3', 'phabricator-diff-path-view' => '8207abf9', 'phabricator-diff-tree-view' => '5d83623b', 'phabricator-drag-and-drop-file-upload' => '4370900d', @@ -1841,9 +1841,6 @@ return array( 'javelin-workflow', 'phabricator-draggable-list', ), - 'a39fd98e' => array( - 'javelin-dom', - ), 'a4356cde' => array( 'javelin-install', 'javelin-dom', @@ -2135,6 +2132,9 @@ return array( 'javelin-dom', 'phabricator-draggable-list', ), + 'e6b9b4f3' => array( + 'javelin-dom', + ), 'e8240b50' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index 3ba9cb6862..083ca9ac5c 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -43,6 +43,7 @@ JX.install('DiffInline', { _undoText: null, _draftRequest: null, + _skipFocus: false, bindToRow: function(row) { this._row = row; @@ -95,7 +96,7 @@ JX.install('DiffInline', { // which we're currently editing. This flow is a little clumsy, but // reasonable until some future change moves away from "send down // the inline, then immediately click edit". - this.edit(this._originalText); + this.edit(this._originalText, true); } else { this.setInvisible(false); } @@ -389,7 +390,9 @@ JX.install('DiffInline', { return changeset.newInlineReply(this, text); }, - edit: function(text) { + edit: function(text, skip_focus) { + this._skipFocus = !!skip_focus; + // If you edit an inline ("A"), modify the text ("AB"), cancel, and then // edit it again: discard the undo state ("AB"). Otherwise we end up // with an open editor and an active "Undo" link, which is weird. @@ -607,19 +610,24 @@ JX.install('DiffInline', { result_row = row; } - // If the row has a textarea, focus it. This allows the user to start - // typing a comment immediately after a "new", "edit", or "reply" - // action. - var textareas = JX.DOM.scry( - row, - 'textarea', - 'differential-inline-comment-edit-textarea'); - if (textareas.length) { - var area = textareas[0]; - area.focus(); + if (!this._skipFocus) { + // If the row has a textarea, focus it. This allows the user to start + // typing a comment immediately after a "new", "edit", or "reply" + // action. - var length = area.value.length; - JX.TextAreaUtils.setSelectionRange(area, length, length); + // (When simulating an "edit" on page load, we don't do this.) + + var textareas = JX.DOM.scry( + row, + 'textarea', + 'differential-inline-comment-edit-textarea'); + if (textareas.length) { + var area = textareas[0]; + area.focus(); + + var length = area.value.length; + JX.TextAreaUtils.setSelectionRange(area, length, length); + } } row = next_row;