Persist "Show Changeset" and improve path text selection

Summary:
Ref T13513. Currently:

  - If you click the "Show Changeset" button, your state change doesn't actually get saved on the server.
  - It's hard to select a changeset path name for copy/paste because the "highlight the header" code tends to eat the event.

Instead: persist the former event; make the actual path text not be part of the highlight hitbox.

Test Plan:
  - Clicked "Show Changeset", reloaded, saw changeset visibility persisted.
  - Selected changeset path text without issues.
  - Clicked non-text header area to select/deselect changesets.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21236
This commit is contained in:
epriestley
2020-05-08 06:36:31 -07:00
parent fa2d30ee36
commit 24ba66f106
4 changed files with 45 additions and 29 deletions

View File

@@ -886,6 +886,13 @@ JX.install('DiffChangeset', {
},
_onClickHeader: function(e) {
// If the user clicks the actual path name text, don't count this as
// a selection action: we want to let them select the path.
var path_name = e.getNode('changeset-header-path-name');
if (path_name) {
return;
}
e.prevent();
if (this._isSelected) {
@@ -986,18 +993,16 @@ JX.install('DiffChangeset', {
_onClickShowButton: function(e) {
e.prevent();
this.setVisible(true);
// We're always showing the changeset, but want to make sure the state
// change is persisted on the server.
this.toggleVisibility();
},
isVisible: function() {
return this._visible;
},
_onundo: function(e) {
e.kill();
this.toggleVisibility();
},
getPathView: function() {
if (!this._pathView) {
var view = new JX.DiffPathView()