1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

In Differential, make the "Open in Editor" keystroke work with no selection, or a change or inline selected

Summary:
Ref T13515. Currently, "Open in Editor" only works with a file-level selection.

  - If we have a change-level or inline-level selection, open the parent changeset.
  - If we have no selection, but the banner is showing something, open the fine shown in the banner.

Test Plan: With files, inlines, changes, and no selection, pressed "\". Saw files pop open in my external editor.

Maniphest Tasks: T13515

Differential Revision: https://secure.phabricator.com/D21148
This commit is contained in:
epriestley 2020-04-19 07:18:24 -07:00
parent f02024615a
commit 537ff68edd
2 changed files with 26 additions and 21 deletions

View file

@ -12,7 +12,7 @@ return array(
'core.pkg.css' => 'a4a2417c', 'core.pkg.css' => 'a4a2417c',
'core.pkg.js' => '4355a8d3', 'core.pkg.js' => '4355a8d3',
'differential.pkg.css' => '607c84be', 'differential.pkg.css' => '607c84be',
'differential.pkg.js' => 'ececaeef', 'differential.pkg.js' => '1a72918e',
'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7', 'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d', 'maniphest.pkg.css' => '35995d6d',
@ -378,7 +378,7 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => '5a4e4a3b', 'rsrc/js/application/diff/DiffChangeset.js' => '5a4e4a3b',
'rsrc/js/application/diff/DiffChangesetList.js' => 'f813ef26', 'rsrc/js/application/diff/DiffChangesetList.js' => '139299d7',
'rsrc/js/application/diff/DiffInline.js' => '16e97ebc', 'rsrc/js/application/diff/DiffInline.js' => '16e97ebc',
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
@ -775,7 +775,7 @@ return array(
'phabricator-darkmessage' => '26cd4b73', 'phabricator-darkmessage' => '26cd4b73',
'phabricator-dashboard-css' => '5a205b9d', 'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => '5a4e4a3b', 'phabricator-diff-changeset' => '5a4e4a3b',
'phabricator-diff-changeset-list' => 'f813ef26', 'phabricator-diff-changeset-list' => '139299d7',
'phabricator-diff-inline' => '16e97ebc', 'phabricator-diff-inline' => '16e97ebc',
'phabricator-drag-and-drop-file-upload' => '4370900d', 'phabricator-drag-and-drop-file-upload' => '4370900d',
'phabricator-draggable-list' => '0169e425', 'phabricator-draggable-list' => '0169e425',
@ -1023,6 +1023,10 @@ return array(
'javelin-uri', 'javelin-uri',
'phabricator-keyboard-shortcut', 'phabricator-keyboard-shortcut',
), ),
'139299d7' => array(
'javelin-install',
'phuix-button-view',
),
'139ef688' => array( '139ef688' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -2166,10 +2170,6 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'javelin-dom', 'javelin-dom',
), ),
'f813ef26' => array(
'javelin-install',
'phuix-button-view',
),
'f84bcbf4' => array( 'f84bcbf4' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',

View file

@ -462,23 +462,28 @@ JX.install('DiffChangesetList', {
var pht = this.getTranslations(); var pht = this.getTranslations();
var cursor = this._cursorItem; var cursor = this._cursorItem;
var changeset;
if (cursor) { if (cursor) {
if (cursor.type == 'file') { changeset = cursor.changeset;
var changeset = cursor.changeset;
var editor_uri = changeset.getEditorURI();
if (editor_uri === null) {
this._warnUser(pht('No external editor is configured.'));
return;
}
JX.$U(editor_uri).go();
return;
}
} }
this._warnUser(pht('You must select a file to edit.')); if (!changeset) {
changeset = this._getVisibleChangeset();
}
if (!changeset) {
this._warnUser(pht('You must select a file to edit.'));
return;
}
var editor_uri = changeset.getEditorURI();
if (editor_uri === null) {
this._warnUser(pht('No external editor is configured.'));
return;
}
JX.$U(editor_uri).go();
}, },
_onkeycollapse: function() { _onkeycollapse: function() {