1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Make DocumentEngine source line linking behavior better when blame is shown

Summary: Ref T13105. The line linker behavior currently has trouble identifying the line number when blame is active. Improve this, albeit not the most cleanly.

Test Plan: Selected lines with blame on.

Maniphest Tasks: T13105

Differential Revision: https://secure.phabricator.com/D19310
This commit is contained in:
epriestley 2018-04-09 05:08:49 -07:00
parent 09c6d42b95
commit 11664277b3
2 changed files with 24 additions and 9 deletions

View file

@ -471,7 +471,7 @@ return array(
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0', 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a', 'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a',
'rsrc/js/core/behavior-line-linker.js' => 'febf4ae7', 'rsrc/js/core/behavior-line-linker.js' => '1e017314',
'rsrc/js/core/behavior-more.js' => 'a80d0378', 'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0', 'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0',
'rsrc/js/core/behavior-oncopy.js' => '2926fff2', 'rsrc/js/core/behavior-oncopy.js' => '2926fff2',
@ -634,7 +634,7 @@ return array(
'javelin-behavior-phabricator-gesture-example' => '558829c2', 'javelin-behavior-phabricator-gesture-example' => '558829c2',
'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0', 'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0',
'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0', 'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0',
'javelin-behavior-phabricator-line-linker' => 'febf4ae7', 'javelin-behavior-phabricator-line-linker' => '1e017314',
'javelin-behavior-phabricator-nav' => '836f966d', 'javelin-behavior-phabricator-nav' => '836f966d',
'javelin-behavior-phabricator-notification-example' => '8ce821c5', 'javelin-behavior-phabricator-notification-example' => '8ce821c5',
'javelin-behavior-phabricator-object-selector' => '77c1f0b0', 'javelin-behavior-phabricator-object-selector' => '77c1f0b0',
@ -998,6 +998,12 @@ return array(
'javelin-workflow', 'javelin-workflow',
'javelin-magical-init', 'javelin-magical-init',
), ),
'1e017314' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-history',
),
'1f6794f6' => array( '1f6794f6' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -2159,12 +2165,6 @@ return array(
'javelin-view-visitor', 'javelin-view-visitor',
'javelin-util', 'javelin-util',
), ),
'febf4ae7' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-history',
),
), ),
'packages' => array( 'packages' => array(
'conpherence.pkg.css' => array( 'conpherence.pkg.css' => array(

View file

@ -20,7 +20,22 @@ JX.behavior('phabricator-line-linker', function() {
} }
function getRowNumber(tr) { function getRowNumber(tr) {
var th = tr.firstChild; // Starting from the left, find the rightmost "<th />" tag among all
// "<th />" tags at the start of the row. Our goal here is to skip over
// blame information in Diffusion. This could probably be significantly
// more graceful.
var th = null;
for (var ii = 0; ii < tr.childNodes.length; ii++) {
if (JX.DOM.isType(tr.childNodes[ii], 'th')) {
th = tr.childNodes[ii];
continue;
}
break;
}
if (!th) {
return null;
}
// If the "<th />" tag contains an "<a />" with "data-n" that we're using // If the "<th />" tag contains an "<a />" with "data-n" that we're using
// to prevent copy/paste of line numbers, use that. // to prevent copy/paste of line numbers, use that.