Improve inline comment previews
Summary: - When an inline comment preview corresponds to an inline comment on the page, link to it. Just punt in the tough case where the inline is on some other page. - In "haunted" mode, "z" now toggles through three modes: normal, comment area only, and comment + previews. Test Plan: - Viewed visible and not-visible inline comment previews, clicked "View" links. - Tapped "z" a bunch to toggle haunt modes. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T517, T214 Differential Revision: https://secure.phabricator.com/D2041
This commit is contained in:
@@ -47,7 +47,27 @@ JX.behavior('differential-feedback-preview', function(config) {
|
||||
|
||||
function refreshInlinePreview() {
|
||||
new JX.Request(config.inlineuri, function(r) {
|
||||
JX.DOM.setContent(JX.$(config.inline), JX.$H(r));
|
||||
var inline = JX.$(config.inline);
|
||||
|
||||
JX.DOM.setContent(inline, JX.$H(r));
|
||||
|
||||
// Go through the previews and activate any "View" links where the
|
||||
// actual comment appears in the document.
|
||||
|
||||
var links = JX.DOM.scry(
|
||||
inline,
|
||||
'a',
|
||||
'differential-inline-preview-jump');
|
||||
for (var ii = 0; ii < links.length; ii++) {
|
||||
var data = JX.Stratcom.getData(links[ii]);
|
||||
try {
|
||||
JX.$(data.anchor);
|
||||
links[ii].href = '#' + data.anchor;
|
||||
JX.DOM.setContent(links[ii], 'View');
|
||||
} catch (ignored) {
|
||||
// This inline comment isn't visible, e.g. on some other diff.
|
||||
}
|
||||
}
|
||||
})
|
||||
.setTimeout(5000)
|
||||
.send();
|
||||
|
||||
Reference in New Issue
Block a user