@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When following a link to a particular line ("/example.txt$12"), scroll to that line

Summary:
Depends on D19349. Ref T13105. This was the behavior in Diffusion before with a little hard-coded snippet.

Remove that snippet ("diffusion-jump-to") and add a more general-purpose snippet to SourceView.

This is a tiny bit hacky still (and probably doesn't work quite right with Quicksand) but gets things working again and works in all of Files, Paste, and Diffusion.

Test Plan: Followed links to particular lines in Paste, Files and Diffusion; got scrolled to the right place.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13105

Differential Revision: https://secure.phabricator.com/D19350

+25 -30
+8 -15
resources/celerity/map.php
··· 385 385 'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04', 386 386 'rsrc/js/application/diffusion/behavior-commit-graph.js' => '75b83cbb', 387 387 'rsrc/js/application/diffusion/behavior-diffusion-browse-file.js' => '054a0f0b', 388 - 'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef', 389 388 'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947', 390 389 'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'f01586dc', 391 390 'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '1db13e70', ··· 471 470 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 472 471 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0', 473 472 'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a', 474 - 'rsrc/js/core/behavior-line-linker.js' => '36165eb1', 473 + 'rsrc/js/core/behavior-line-linker.js' => '66a62306', 475 474 'rsrc/js/core/behavior-more.js' => 'a80d0378', 476 475 'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0', 477 476 'rsrc/js/core/behavior-oncopy.js' => '2926fff2', ··· 601 600 'javelin-behavior-diffusion-browse-file' => '054a0f0b', 602 601 'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04', 603 602 'javelin-behavior-diffusion-commit-graph' => '75b83cbb', 604 - 'javelin-behavior-diffusion-jump-to' => '73d09eef', 605 603 'javelin-behavior-diffusion-locate-file' => '6d3e1947', 606 604 'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc', 607 605 'javelin-behavior-document-engine' => '0333c0b6', ··· 634 632 'javelin-behavior-phabricator-gesture-example' => '558829c2', 635 633 'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0', 636 634 'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0', 637 - 'javelin-behavior-phabricator-line-linker' => '36165eb1', 635 + 'javelin-behavior-phabricator-line-linker' => '66a62306', 638 636 'javelin-behavior-phabricator-nav' => '94b7c320', 639 637 'javelin-behavior-phabricator-notification-example' => '8ce821c5', 640 638 'javelin-behavior-phabricator-object-selector' => '77c1f0b0', ··· 1097 1095 'javelin-util', 1098 1096 'javelin-dom', 1099 1097 'javelin-vector', 1100 - ), 1101 - '36165eb1' => array( 1102 - 'javelin-behavior', 1103 - 'javelin-stratcom', 1104 - 'javelin-dom', 1105 - 'javelin-history', 1106 1098 ), 1107 1099 '3ab51e2c' => array( 1108 1100 'javelin-behavior', ··· 1395 1387 'phabricator-darklog', 1396 1388 'phabricator-darkmessage', 1397 1389 ), 1390 + '66a62306' => array( 1391 + 'javelin-behavior', 1392 + 'javelin-stratcom', 1393 + 'javelin-dom', 1394 + 'javelin-history', 1395 + ), 1398 1396 '66a6def1' => array( 1399 1397 'javelin-behavior', 1400 1398 'javelin-dom', ··· 1469 1467 ), 1470 1468 '7319e029' => array( 1471 1469 'javelin-behavior', 1472 - 'javelin-dom', 1473 - ), 1474 - '73d09eef' => array( 1475 - 'javelin-behavior', 1476 - 'javelin-vector', 1477 1470 'javelin-dom', 1478 1471 ), 1479 1472 '758b4758' => array(
+5
src/view/layout/PhabricatorSourceCodeView.php
··· 96 96 } 97 97 98 98 $base_uri = (string)$this->uri; 99 + $wrote_anchor = false; 99 100 foreach ($lines as $line) { 100 101 $row_attributes = array(); 101 102 if (isset($this->highlights[$line_number])) { 102 103 $row_attributes['class'] = 'phabricator-source-highlight'; 104 + if (!$wrote_anchor) { 105 + $row_attributes['id'] = 'phabricator-line-linker-anchor'; 106 + $wrote_anchor = true; 107 + } 103 108 } 104 109 105 110 if ($this->canClickHighlight) {
-15
webroot/rsrc/js/application/diffusion/behavior-jump-to.js
··· 1 - /** 2 - * @provides javelin-behavior-diffusion-jump-to 3 - * @requires javelin-behavior 4 - * javelin-vector 5 - * javelin-dom 6 - */ 7 - 8 - JX.behavior('diffusion-jump-to', function(config) { 9 - 10 - setTimeout(function() { 11 - var pos = JX.Vector.getPosWithScroll(JX.$(config.target)); 12 - JX.DOM.scrollToPosition(0, pos.y - 100); 13 - }, 0); 14 - 15 - });
+12
webroot/rsrc/js/core/behavior-line-linker.js
··· 176 176 } 177 177 }); 178 178 179 + 180 + // Try to jump to the highlighted lines if we don't have an explicit anchor 181 + // in the URI. 182 + if (!window.location.hash.length) { 183 + try { 184 + var anchor = JX.$('phabricator-line-linker-anchor'); 185 + JX.DOM.scrollToPosition(0, JX.$V(anchor).y - 60); 186 + } catch (ex) { 187 + // If we didn't hit an element on the page, just move on. 188 + } 189 + } 190 + 179 191 });