mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-29 16:08:22 +01:00
Make symbol linking more lenient.
Summary: Sometimes a symbol has a nested <span> in it. Clicks on that should count as clicks on the symbol. So keep looking for symbols among the ancestors of the click target. This is a silly method because I don't know if there's a more idiomatic way to do it in Javelin. Test Plan: Open a Differential revision where part of a symbol is highlighted. Click on the highlighted part. Symbol search opens. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Maniphest Tasks: T1577 Differential Revision: https://secure.phabricator.com/D3113
This commit is contained in:
parent
606ef34d61
commit
b43e6f2a5f
1 changed files with 15 additions and 11 deletions
|
@ -19,17 +19,21 @@ JX.behavior('repository-crossreference', function(config) {
|
|||
function(e) {
|
||||
var target = e.getTarget();
|
||||
var map = {nc : 'class', nf : 'function'};
|
||||
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
||||
var symbol = target.textContent || target.innerText;
|
||||
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
||||
uri.addQueryParams({
|
||||
type : map[target.className],
|
||||
lang : config.lang,
|
||||
projects : config.projects.join(','),
|
||||
jump : true
|
||||
});
|
||||
window.open(uri);
|
||||
e.kill();
|
||||
while (target !== document.body) {
|
||||
if (JX.DOM.isNode(target, 'span') && (target.className in map)) {
|
||||
var symbol = target.textContent || target.innerText;
|
||||
var uri = JX.$U('/diffusion/symbol/' + symbol + '/');
|
||||
uri.addQueryParams({
|
||||
type : map[target.className],
|
||||
lang : config.lang,
|
||||
projects : config.projects.join(','),
|
||||
jump : true
|
||||
});
|
||||
window.open(uri);
|
||||
e.kill();
|
||||
break;
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue