@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.

Make line selection in source code views less fragile and more consistent

Summary:
Depends on D19347. Ref T13105. See PHI565. The "highlight lines" behavior is interacting poorly with the new blame element in Diffusion.

Make the behavior a little simpler and hopefully more robust.

Test Plan:
- Clicked commit/revision links in Diffusion, saw the links get followed instead of the lines highlighted.
- Highlighted lines in Diffusion, saw just the line/code highlight instead of the whole thing.
- Highlighted lines in Paste and new-style Harbormaster build logs, saw consistent behavior.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13105

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

+25 -35
+10 -10
resources/celerity/map.php
··· 119 119 'rsrc/css/font/font-lato.css' => 'c7ccd872', 120 120 'rsrc/css/font/phui-font-icon-base.css' => '870a7360', 121 121 'rsrc/css/layout/phabricator-filetree-view.css' => 'b912ad97', 122 - 'rsrc/css/layout/phabricator-source-code-view.css' => '326df52d', 122 + 'rsrc/css/layout/phabricator-source-code-view.css' => 'c5edc888', 123 123 'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494', 124 124 'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68', 125 125 'rsrc/css/phui/button/phui-button.css' => '1863cc6e', ··· 471 471 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 472 472 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0', 473 473 'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a', 474 - 'rsrc/js/core/behavior-line-linker.js' => '1e017314', 474 + 'rsrc/js/core/behavior-line-linker.js' => '69837bed', 475 475 'rsrc/js/core/behavior-more.js' => 'a80d0378', 476 476 'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0', 477 477 'rsrc/js/core/behavior-oncopy.js' => '2926fff2', ··· 634 634 'javelin-behavior-phabricator-gesture-example' => '558829c2', 635 635 'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0', 636 636 'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0', 637 - 'javelin-behavior-phabricator-line-linker' => '1e017314', 637 + 'javelin-behavior-phabricator-line-linker' => '69837bed', 638 638 'javelin-behavior-phabricator-nav' => '94b7c320', 639 639 'javelin-behavior-phabricator-notification-example' => '8ce821c5', 640 640 'javelin-behavior-phabricator-object-selector' => '77c1f0b0', ··· 780 780 'phabricator-search-results-css' => '505dd8cf', 781 781 'phabricator-shaped-request' => '7cbe244b', 782 782 'phabricator-slowvote-css' => 'a94b7230', 783 - 'phabricator-source-code-view-css' => '326df52d', 783 + 'phabricator-source-code-view-css' => 'c5edc888', 784 784 'phabricator-standard-page-view' => '34ee718b', 785 785 'phabricator-textareautils' => '320810c8', 786 786 'phabricator-title' => '485aaa6c', ··· 1003 1003 'javelin-workflow', 1004 1004 'javelin-magical-init', 1005 1005 ), 1006 - '1e017314' => array( 1007 - 'javelin-behavior', 1008 - 'javelin-stratcom', 1009 - 'javelin-dom', 1010 - 'javelin-history', 1011 - ), 1012 1006 '1f6794f6' => array( 1013 1007 'javelin-behavior', 1014 1008 'javelin-stratcom', ··· 1412 1406 'javelin-install', 1413 1407 'javelin-dom', 1414 1408 'phuix-button-view', 1409 + ), 1410 + '69837bed' => array( 1411 + 'javelin-behavior', 1412 + 'javelin-stratcom', 1413 + 'javelin-dom', 1414 + 'javelin-history', 1415 1415 ), 1416 1416 '69adf288' => array( 1417 1417 'javelin-install',
+5 -1
webroot/rsrc/css/layout/phabricator-source-code-view.css
··· 52 52 text-decoration: none; 53 53 } 54 54 55 - .phabricator-source-highlight { 55 + .phabricator-source-highlight .phabricator-source-code { 56 56 background: {$paste.highlight}; 57 + } 58 + 59 + .phabricator-source-highlight .phabricator-source-line { 60 + background: {$paste.border}; 57 61 } 58 62 59 63 .phabricator-source-code-summary {
+10 -24
webroot/rsrc/js/core/behavior-line-linker.js
··· 19 19 // Ignore. 20 20 } 21 21 22 - function getRowNumber(tr) { 23 - // Starting from the left, find the rightmost "<th />" tag among all 24 - // "<th />" tags at the start of the row. Our goal here is to skip over 25 - // blame information in Diffusion. This could probably be significantly 26 - // more graceful. 27 - var th = null; 28 - for (var ii = 0; ii < tr.childNodes.length; ii++) { 29 - if (JX.DOM.isType(tr.childNodes[ii], 'th')) { 30 - th = tr.childNodes[ii]; 31 - continue; 32 - } 33 - break; 34 - } 35 - 36 - if (!th) { 37 - return null; 38 - } 39 - 22 + function getRowNumber(th) { 40 23 // If the "<th />" tag contains an "<a />" with "data-n" that we're using 41 24 // to prevent copy/paste of line numbers, use that. 42 25 if (th.firstChild) { ··· 51 34 52 35 JX.Stratcom.listen( 53 36 ['click', 'mousedown'], 54 - ['phabricator-source', 'tag:tr', 'tag:th', 'tag:a'], 37 + ['phabricator-source', 'tag:th', 'tag:a'], 55 38 function(e) { 56 39 if (!e.isNormalMouseEvent()) { 57 40 return; ··· 62 45 // table. The row's immediate ancestor table needs to be the table with 63 46 // the "phabricator-source" sigil. 64 47 65 - var row = e.getNode('tag:tr'); 48 + var cell = e.getNode('tag:th'); 66 49 var table = e.getNode('phabricator-source'); 67 - if (JX.DOM.findAbove(row, 'table') !== table) { 50 + if (JX.DOM.findAbove(cell, 'table') !== table) { 68 51 return; 69 52 } 70 53 71 - var number = getRowNumber(row); 54 + var number = getRowNumber(cell); 72 55 if (!number) { 73 56 return; 74 57 } ··· 81 64 return; 82 65 } 83 66 84 - origin = row; 67 + origin = cell; 85 68 target = origin; 86 69 87 70 root = table; ··· 95 78 if (e.getNode('phabricator-source') !== root) { 96 79 return; 97 80 } 98 - target = e.getNode('tag:tr'); 81 + target = e.getNode('tag:th'); 99 82 100 83 var min; 101 84 var max; ··· 130 113 highlighted = []; 131 114 132 115 // Highlight the newly selected rows. 116 + min = JX.DOM.findAbove(min, 'tr'); 117 + max = JX.DOM.findAbove(max, 'tr'); 118 + 133 119 var cursor = min; 134 120 while (true) { 135 121 JX.DOM.alterClass(cursor, 'phabricator-source-highlight', true);