diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3f852d6048..957b4aaa44 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '845355f4', 'dark-console.pkg.js' => '187792c2', 'differential.pkg.css' => '319dca29', - 'differential.pkg.js' => 'ccf7bdca', + 'differential.pkg.js' => '695827fc', 'diffusion.pkg.css' => '42c75c37', 'diffusion.pkg.js' => 'a98c0bf7', 'maniphest.pkg.css' => '35995d6d', @@ -380,7 +380,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 'rsrc/js/application/diff/DiffChangeset.js' => 'bfdae878', - 'rsrc/js/application/diff/DiffChangesetList.js' => 'a00bf62d', + 'rsrc/js/application/diff/DiffChangesetList.js' => 'b1b8500b', 'rsrc/js/application/diff/DiffInline.js' => 'b00168c1', 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', @@ -775,7 +775,7 @@ return array( 'phabricator-darkmessage' => '26cd4b73', 'phabricator-dashboard-css' => '5a205b9d', 'phabricator-diff-changeset' => 'bfdae878', - 'phabricator-diff-changeset-list' => 'a00bf62d', + 'phabricator-diff-changeset-list' => 'b1b8500b', 'phabricator-diff-inline' => 'b00168c1', 'phabricator-diff-path-view' => '8207abf9', 'phabricator-diff-tree-view' => '5d83623b', @@ -1808,11 +1808,6 @@ return array( 'javelin-util', 'phabricator-keyboard-shortcut', ), - 'a00bf62d' => array( - 'javelin-install', - 'phuix-button-view', - 'phabricator-diff-tree-view', - ), 'a17b84f1' => array( 'javelin-behavior', 'javelin-dom', @@ -1932,6 +1927,11 @@ return array( 'javelin-stratcom', 'javelin-dom', ), + 'b1b8500b' => array( + 'javelin-install', + 'phuix-button-view', + 'phabricator-diff-tree-view', + ), 'b26a41e4' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php index b3e6520fd9..f4ed05545b 100644 --- a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php @@ -45,6 +45,7 @@ final class DifferentialChangesetOneUpRenderer 'span', array( 'aural' => true, + 'data-aural' => true, ), '- '); @@ -52,6 +53,7 @@ final class DifferentialChangesetOneUpRenderer 'span', array( 'aural' => true, + 'data-aural' => true, ), '+ '); @@ -171,7 +173,15 @@ final class DifferentialChangesetOneUpRenderer } $cells[] = $no_copy; - $cells[] = phutil_tag('td', array('class' => $class), $render); + + $cells[] = phutil_tag( + 'td', + array( + 'class' => $class, + 'data-copy-mode' => 'copy-unified', + ), + $render); + $cells[] = $no_coverage; } diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index 24c520dc9a..8284862f0d 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -441,12 +441,22 @@ JX.install('DiffChangesetList', { this._setSourceSelection(null, null); - var config = { - startOffset: start.offset, - endOffset: end.offset - }; - var changeset = start.changeset; + + var config = {}; + if (changeset.getResponseDocumentEngineKey() === null) { + // If the changeset is using a document renderer, we ignore the + // selection range and just treat this as a comment from the first + // block to the last block. + + // If we don't discard the range, we later render a bogus highlight + // if the block content is complex (like a Jupyter notebook cell + // with images). + + config.startOffset = start.offset; + config.endOffset = end.offset; + } + changeset.newInlineForRange(start.targetNode, end.targetNode, config); }, @@ -2623,7 +2633,7 @@ JX.install('DiffChangesetList', { td = cells[cells.length - 1]; is_end = true; } else { - td = JX.DOM.findAbove(fragment, 'td'); + td = this._findContentCell(fragment); is_end = false; } @@ -2707,6 +2717,16 @@ JX.install('DiffChangesetList', { }, _getSelectionOffset: function(node, target) { + // If this is an aural hint node in a unified diff, ignore it when + // calculating the selection offset. + if (node.getAttribute && node.getAttribute('data-aural')) { + return { + offset: 0, + content: '', + found: false + }; + } + if (!node.childNodes || !node.childNodes.length) { return { offset: node.textContent.length, @@ -2764,6 +2784,16 @@ JX.install('DiffChangesetList', { _isContentCell: function(node) { return !!node.getAttribute('data-copy-mode'); + }, + + _findContentCell: function(node) { + var cursor = node; + while (true) { + cursor = JX.DOM.findAbove(cursor, 'td'); + if (this._isContentCell(cursor)) { + return cursor; + } + } } }