mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Allow/fix sending forms to new tab or window
Test Plan: Ctrl+click on Show Diff in Chrome - button is not grayed-out, new tab is opened. Click on it - button is grayed out. Repeat in Firefox. Reviewers: epriestley, tuomaspelkonen Reviewed By: epriestley CC: aran, Koolvin Maniphest Tasks: T1137 Differential Revision: https://secure.phabricator.com/D2278
This commit is contained in:
parent
6cdbfe860f
commit
0141bb8ee4
2 changed files with 35 additions and 20 deletions
|
@ -773,7 +773,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-aphront-form-disable-on-submit' =>
|
||||
array(
|
||||
'uri' => '/res/6c659ede/rsrc/js/application/core/behavior-form.js',
|
||||
'uri' => '/res/ca54e8b9/rsrc/js/application/core/behavior-form.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2446,7 +2446,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/9c4e265b/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'ba0a3c7e' =>
|
||||
'0c96375e' =>
|
||||
array(
|
||||
'name' => 'core.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -2469,7 +2469,7 @@ celerity_register_resource_map(array(
|
|||
15 => 'javelin-behavior-phabricator-tooltips',
|
||||
16 => 'phabricator-prefab',
|
||||
),
|
||||
'uri' => '/res/pkg/ba0a3c7e/core.pkg.js',
|
||||
'uri' => '/res/pkg/0c96375e/core.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'1138d3d1' =>
|
||||
|
@ -2641,7 +2641,7 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
||||
'javelin-behavior-aphront-drag-and-drop' => 'e4ddcab5',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => 'e4ddcab5',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => 'ba0a3c7e',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '0c96375e',
|
||||
'javelin-behavior-audit-preview' => '5e68be89',
|
||||
'javelin-behavior-buoyant' => 'e4ddcab5',
|
||||
'javelin-behavior-differential-accept-with-errors' => 'e4ddcab5',
|
||||
|
@ -2661,20 +2661,20 @@ celerity_register_resource_map(array(
|
|||
'javelin-behavior-maniphest-transaction-controls' => '7707de41',
|
||||
'javelin-behavior-maniphest-transaction-expand' => '7707de41',
|
||||
'javelin-behavior-maniphest-transaction-preview' => '7707de41',
|
||||
'javelin-behavior-phabricator-autofocus' => 'ba0a3c7e',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => 'ba0a3c7e',
|
||||
'javelin-behavior-phabricator-autofocus' => '0c96375e',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => '0c96375e',
|
||||
'javelin-behavior-phabricator-object-selector' => 'e4ddcab5',
|
||||
'javelin-behavior-phabricator-oncopy' => 'ba0a3c7e',
|
||||
'javelin-behavior-phabricator-tooltips' => 'ba0a3c7e',
|
||||
'javelin-behavior-phabricator-watch-anchor' => 'ba0a3c7e',
|
||||
'javelin-behavior-refresh-csrf' => 'ba0a3c7e',
|
||||
'javelin-behavior-phabricator-oncopy' => '0c96375e',
|
||||
'javelin-behavior-phabricator-tooltips' => '0c96375e',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '0c96375e',
|
||||
'javelin-behavior-refresh-csrf' => '0c96375e',
|
||||
'javelin-behavior-repository-crossreference' => 'e4ddcab5',
|
||||
'javelin-behavior-workflow' => 'ba0a3c7e',
|
||||
'javelin-behavior-workflow' => '0c96375e',
|
||||
'javelin-dom' => '8a5de8a3',
|
||||
'javelin-event' => '8a5de8a3',
|
||||
'javelin-install' => '8a5de8a3',
|
||||
'javelin-json' => '8a5de8a3',
|
||||
'javelin-mask' => 'ba0a3c7e',
|
||||
'javelin-mask' => '0c96375e',
|
||||
'javelin-request' => '8a5de8a3',
|
||||
'javelin-stratcom' => '8a5de8a3',
|
||||
'javelin-tokenizer' => '97f65640',
|
||||
|
@ -2686,7 +2686,7 @@ celerity_register_resource_map(array(
|
|||
'javelin-uri' => '8a5de8a3',
|
||||
'javelin-util' => '8a5de8a3',
|
||||
'javelin-vector' => '8a5de8a3',
|
||||
'javelin-workflow' => 'ba0a3c7e',
|
||||
'javelin-workflow' => '0c96375e',
|
||||
'maniphest-task-summary-css' => '7839ae2d',
|
||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||
'phabricator-app-buttons-css' => '9c4e265b',
|
||||
|
@ -2695,20 +2695,20 @@ celerity_register_resource_map(array(
|
|||
'phabricator-core-css' => '9c4e265b',
|
||||
'phabricator-directory-css' => '9c4e265b',
|
||||
'phabricator-drag-and-drop-file-upload' => 'e4ddcab5',
|
||||
'phabricator-dropdown-menu' => 'ba0a3c7e',
|
||||
'phabricator-dropdown-menu' => '0c96375e',
|
||||
'phabricator-flag-css' => '9c4e265b',
|
||||
'phabricator-jump-nav' => '9c4e265b',
|
||||
'phabricator-keyboard-shortcut' => 'ba0a3c7e',
|
||||
'phabricator-keyboard-shortcut-manager' => 'ba0a3c7e',
|
||||
'phabricator-menu-item' => 'ba0a3c7e',
|
||||
'phabricator-keyboard-shortcut' => '0c96375e',
|
||||
'phabricator-keyboard-shortcut-manager' => '0c96375e',
|
||||
'phabricator-menu-item' => '0c96375e',
|
||||
'phabricator-object-selector-css' => '1138d3d1',
|
||||
'phabricator-paste-file-upload' => 'ba0a3c7e',
|
||||
'phabricator-prefab' => 'ba0a3c7e',
|
||||
'phabricator-paste-file-upload' => '0c96375e',
|
||||
'phabricator-prefab' => '0c96375e',
|
||||
'phabricator-project-tag-css' => '7839ae2d',
|
||||
'phabricator-remarkup-css' => '9c4e265b',
|
||||
'phabricator-shaped-request' => 'e4ddcab5',
|
||||
'phabricator-standard-page-view' => '9c4e265b',
|
||||
'phabricator-tooltip' => 'ba0a3c7e',
|
||||
'phabricator-tooltip' => '0c96375e',
|
||||
'phabricator-transaction-view-css' => '9c4e265b',
|
||||
'syntax-highlighting-css' => '9c4e265b',
|
||||
),
|
||||
|
|
|
@ -7,6 +7,12 @@ JX.behavior('aphront-form-disable-on-submit', function(config) {
|
|||
|
||||
var restore = [];
|
||||
var root = null;
|
||||
var new_tab = false;
|
||||
|
||||
JX.Stratcom.listen('click', 'tag:button', function(e) {
|
||||
var raw = e.getRawEvent();
|
||||
new_tab = (raw.altKey || raw.ctrlKey || raw.metaKey || raw.shiftKey);
|
||||
});
|
||||
|
||||
JX.Stratcom.listen('submit', 'tag:form', function(e) {
|
||||
if (e.getNode('workflow')) {
|
||||
|
@ -16,6 +22,15 @@ JX.behavior('aphront-form-disable-on-submit', function(config) {
|
|||
}
|
||||
|
||||
root = e.getNode('tag:form');
|
||||
|
||||
// Open the form to a new tab in Firefox explicitly (automatic in Chrome).
|
||||
// We render some buttons as links so users may be confused that the links
|
||||
// don't open to new tabs with Ctrl+click as normal links.
|
||||
root.target = (new_tab ? '_blank' : '');
|
||||
if (new_tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (root._disabled) {
|
||||
e.kill();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue