mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Hide selection to provide a visual cue about clipboard JS magic in Differential
Summary: Inspired by D2242. Test Plan: Select text in left pane. Select text in right pane. Select all. Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2249
This commit is contained in:
parent
44bbdec9ac
commit
0732f2f9dd
5 changed files with 76 additions and 20 deletions
|
@ -533,7 +533,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'differential-core-view-css' =>
|
'differential-core-view-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/0bc9223a/rsrc/css/application/differential/core.css',
|
'uri' => '/res/2303c309/rsrc/css/application/differential/core.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -994,6 +994,18 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/js/application/differential/behavior-show-more.js',
|
'disk' => '/rsrc/js/application/differential/behavior-show-more.js',
|
||||||
),
|
),
|
||||||
|
'javelin-behavior-differential-user-select' =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/f0e3b555/rsrc/js/application/differential/behavior-user-select.js',
|
||||||
|
'type' => 'js',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-behavior',
|
||||||
|
1 => 'javelin-dom',
|
||||||
|
2 => 'javelin-stratcom',
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/js/application/differential/behavior-user-select.js',
|
||||||
|
),
|
||||||
'javelin-behavior-diffusion-commit-graph' =>
|
'javelin-behavior-diffusion-commit-graph' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/cfe336e8/rsrc/js/application/diffusion/behavior-commit-graph.js',
|
'uri' => '/res/cfe336e8/rsrc/js/application/diffusion/behavior-commit-graph.js',
|
||||||
|
@ -2472,7 +2484,7 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/0c96375e/core.pkg.js',
|
'uri' => '/res/pkg/0c96375e/core.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'1138d3d1' =>
|
'a841d960' =>
|
||||||
array(
|
array(
|
||||||
'name' => 'differential.pkg.css',
|
'name' => 'differential.pkg.css',
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
|
@ -2491,7 +2503,7 @@ celerity_register_resource_map(array(
|
||||||
11 => 'differential-local-commits-view-css',
|
11 => 'differential-local-commits-view-css',
|
||||||
12 => 'inline-comment-summary-css',
|
12 => 'inline-comment-summary-css',
|
||||||
),
|
),
|
||||||
'uri' => '/res/pkg/1138d3d1/differential.pkg.css',
|
'uri' => '/res/pkg/a841d960/differential.pkg.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
),
|
),
|
||||||
'e4ddcab5' =>
|
'e4ddcab5' =>
|
||||||
|
@ -2614,7 +2626,7 @@ celerity_register_resource_map(array(
|
||||||
'aphront-dialog-view-css' => '9c4e265b',
|
'aphront-dialog-view-css' => '9c4e265b',
|
||||||
'aphront-error-view-css' => '9c4e265b',
|
'aphront-error-view-css' => '9c4e265b',
|
||||||
'aphront-form-view-css' => '9c4e265b',
|
'aphront-form-view-css' => '9c4e265b',
|
||||||
'aphront-headsup-action-list-view-css' => '1138d3d1',
|
'aphront-headsup-action-list-view-css' => 'a841d960',
|
||||||
'aphront-headsup-view-css' => '9c4e265b',
|
'aphront-headsup-view-css' => '9c4e265b',
|
||||||
'aphront-list-filter-view-css' => '9c4e265b',
|
'aphront-list-filter-view-css' => '9c4e265b',
|
||||||
'aphront-pager-view-css' => '9c4e265b',
|
'aphront-pager-view-css' => '9c4e265b',
|
||||||
|
@ -2624,19 +2636,19 @@ celerity_register_resource_map(array(
|
||||||
'aphront-tokenizer-control-css' => '9c4e265b',
|
'aphront-tokenizer-control-css' => '9c4e265b',
|
||||||
'aphront-tooltip-css' => '9c4e265b',
|
'aphront-tooltip-css' => '9c4e265b',
|
||||||
'aphront-typeahead-control-css' => '9c4e265b',
|
'aphront-typeahead-control-css' => '9c4e265b',
|
||||||
'differential-changeset-view-css' => '1138d3d1',
|
'differential-changeset-view-css' => 'a841d960',
|
||||||
'differential-core-view-css' => '1138d3d1',
|
'differential-core-view-css' => 'a841d960',
|
||||||
'differential-inline-comment-editor' => 'e4ddcab5',
|
'differential-inline-comment-editor' => 'e4ddcab5',
|
||||||
'differential-local-commits-view-css' => '1138d3d1',
|
'differential-local-commits-view-css' => 'a841d960',
|
||||||
'differential-revision-add-comment-css' => '1138d3d1',
|
'differential-revision-add-comment-css' => 'a841d960',
|
||||||
'differential-revision-comment-css' => '1138d3d1',
|
'differential-revision-comment-css' => 'a841d960',
|
||||||
'differential-revision-comment-list-css' => '1138d3d1',
|
'differential-revision-comment-list-css' => 'a841d960',
|
||||||
'differential-revision-detail-css' => '1138d3d1',
|
'differential-revision-detail-css' => 'a841d960',
|
||||||
'differential-revision-history-css' => '1138d3d1',
|
'differential-revision-history-css' => 'a841d960',
|
||||||
'differential-table-of-contents-css' => '1138d3d1',
|
'differential-table-of-contents-css' => 'a841d960',
|
||||||
'diffusion-commit-view-css' => 'c8ce2d88',
|
'diffusion-commit-view-css' => 'c8ce2d88',
|
||||||
'diffusion-icons-css' => 'c8ce2d88',
|
'diffusion-icons-css' => 'c8ce2d88',
|
||||||
'inline-comment-summary-css' => '1138d3d1',
|
'inline-comment-summary-css' => 'a841d960',
|
||||||
'javelin-behavior' => '8a5de8a3',
|
'javelin-behavior' => '8a5de8a3',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
||||||
'javelin-behavior-aphront-drag-and-drop' => 'e4ddcab5',
|
'javelin-behavior-aphront-drag-and-drop' => 'e4ddcab5',
|
||||||
|
@ -2690,7 +2702,7 @@ celerity_register_resource_map(array(
|
||||||
'maniphest-task-summary-css' => '7839ae2d',
|
'maniphest-task-summary-css' => '7839ae2d',
|
||||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||||
'phabricator-app-buttons-css' => '9c4e265b',
|
'phabricator-app-buttons-css' => '9c4e265b',
|
||||||
'phabricator-content-source-view-css' => '1138d3d1',
|
'phabricator-content-source-view-css' => 'a841d960',
|
||||||
'phabricator-core-buttons-css' => '9c4e265b',
|
'phabricator-core-buttons-css' => '9c4e265b',
|
||||||
'phabricator-core-css' => '9c4e265b',
|
'phabricator-core-css' => '9c4e265b',
|
||||||
'phabricator-directory-css' => '9c4e265b',
|
'phabricator-directory-css' => '9c4e265b',
|
||||||
|
@ -2701,7 +2713,7 @@ celerity_register_resource_map(array(
|
||||||
'phabricator-keyboard-shortcut' => '0c96375e',
|
'phabricator-keyboard-shortcut' => '0c96375e',
|
||||||
'phabricator-keyboard-shortcut-manager' => '0c96375e',
|
'phabricator-keyboard-shortcut-manager' => '0c96375e',
|
||||||
'phabricator-menu-item' => '0c96375e',
|
'phabricator-menu-item' => '0c96375e',
|
||||||
'phabricator-object-selector-css' => '1138d3d1',
|
'phabricator-object-selector-css' => 'a841d960',
|
||||||
'phabricator-paste-file-upload' => '0c96375e',
|
'phabricator-paste-file-upload' => '0c96375e',
|
||||||
'phabricator-prefab' => '0c96375e',
|
'phabricator-prefab' => '0c96375e',
|
||||||
'phabricator-project-tag-css' => '7839ae2d',
|
'phabricator-project-tag-css' => '7839ae2d',
|
||||||
|
|
|
@ -324,6 +324,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
array(
|
array(
|
||||||
'haunt' => $pane_id,
|
'haunt' => $pane_id,
|
||||||
));
|
));
|
||||||
|
Javelin::initBehavior('differential-user-select');
|
||||||
|
|
||||||
$page_pane = id(new DifferentialPrimaryPaneView())
|
$page_pane = id(new DifferentialPrimaryPaneView())
|
||||||
->setLineWidthFromChangesets($changesets)
|
->setLineWidthFromChangesets($changesets)
|
||||||
|
|
|
@ -1579,10 +1579,13 @@ final class DifferentialChangesetParser {
|
||||||
$props = $this->renderPropertyChangeHeader($this->changeset);
|
$props = $this->renderPropertyChangeHeader($this->changeset);
|
||||||
$table = null;
|
$table = null;
|
||||||
if ($contents) {
|
if ($contents) {
|
||||||
$table =
|
$table = javelin_render_tag(
|
||||||
'<table class="differential-diff remarkup-code PhabricatorMonospaced">'.
|
'table',
|
||||||
$contents.
|
array(
|
||||||
'</table>';
|
'class' => 'differential-diff remarkup-code PhabricatorMonospaced',
|
||||||
|
'sigil' => 'differential-diff',
|
||||||
|
),
|
||||||
|
$contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$table && !$props) {
|
if (!$table && !$props) {
|
||||||
|
|
|
@ -27,3 +27,11 @@
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.differential-unselectable tr td:nth-of-type(1) {
|
||||||
|
-moz-user-select: -moz-none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
* @provides javelin-behavior-differential-user-select
|
||||||
|
* @requires javelin-behavior
|
||||||
|
* javelin-dom
|
||||||
|
* javelin-stratcom
|
||||||
|
*/
|
||||||
|
|
||||||
|
JX.behavior('differential-user-select', function() {
|
||||||
|
|
||||||
|
var unselectable;
|
||||||
|
|
||||||
|
function isOnRight(node) {
|
||||||
|
return node.parentNode.firstChild != node.previousSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'mousedown',
|
||||||
|
null,
|
||||||
|
function(e) {
|
||||||
|
var key = 'differential-unselectable';
|
||||||
|
if (unselectable) {
|
||||||
|
JX.DOM.alterClass(unselectable, key, false);
|
||||||
|
}
|
||||||
|
var diff = e.getNode('differential-diff');
|
||||||
|
var td = e.getNode('tag:td');
|
||||||
|
if (diff && td && isOnRight(td)) {
|
||||||
|
unselectable = diff;
|
||||||
|
JX.DOM.alterClass(diff, key, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in a new issue