1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 07:50:57 +01:00

Use "user-select: none" to provide a visual cue about copy/paste JS magic

Summary:
  - For line numbers, use "user-select: none" to make them unselectable. This provides a stronger visual cue that copy/paste is enchanted.
  - In Paste, make it look sensible again after the blame-on-blame refactor in Diffusion. See also TODO to share this code formally.
  - In Diffusion, use the "phabricator-oncopy" behavior.

NOTE: I left blame/commit columns selectable in Diffusion, since you might reasonably want to copy/paste them?

NOTE: In Differential, the left side of the diff still highlights, even though it will be copied only if you select part of a line on the left and nothing else. But this seemed like a reasonable behavior, so I left it.

Test Plan:
  - Looked at Paste. Saw a nice line number column. Selected text, got the expected selection. Copied text, got the expected copy.
  - Looked at Diffusion. Saw a nice line number column, still. Selected text, got expected selection. Copied text, got expected copy.
  - Looked at Differential. Highlighted stuff, got expected results. Copied stuff, got expected results.

Reviewers: btrahan, vrana, jungejason

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1123

Differential Revision: https://secure.phabricator.com/D2242
This commit is contained in:
epriestley 2012-04-16 15:55:16 -07:00
parent c3635e4464
commit 5f0d8e09d8
5 changed files with 45 additions and 18 deletions

View file

@ -524,7 +524,7 @@ celerity_register_resource_map(array(
),
'differential-changeset-view-css' =>
array(
'uri' => '/res/56207509/rsrc/css/application/differential/changeset-view.css',
'uri' => '/res/00dcf176/rsrc/css/application/differential/changeset-view.css',
'type' => 'css',
'requires' =>
array(
@ -638,7 +638,7 @@ celerity_register_resource_map(array(
),
'diffusion-source-css' =>
array(
'uri' => '/res/e133cfdb/rsrc/css/application/diffusion/diffusion-source.css',
'uri' => '/res/662ad6ad/rsrc/css/application/diffusion/diffusion-source.css',
'type' => 'css',
'requires' =>
array(
@ -2464,7 +2464,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/21d01ed8/core.pkg.js',
'type' => 'js',
),
'e7780f43' =>
'04b74eea' =>
array(
'name' => 'differential.pkg.css',
'symbols' =>
@ -2482,7 +2482,7 @@ celerity_register_resource_map(array(
10 => 'phabricator-content-source-view-css',
11 => 'differential-local-commits-view-css',
),
'uri' => '/res/pkg/e7780f43/differential.pkg.css',
'uri' => '/res/pkg/04b74eea/differential.pkg.css',
'type' => 'css',
),
'270dd507' =>
@ -2588,7 +2588,7 @@ celerity_register_resource_map(array(
'aphront-crumbs-view-css' => '30ae3b0f',
'aphront-dialog-view-css' => '30ae3b0f',
'aphront-form-view-css' => '30ae3b0f',
'aphront-headsup-action-list-view-css' => 'e7780f43',
'aphront-headsup-action-list-view-css' => '04b74eea',
'aphront-list-filter-view-css' => '30ae3b0f',
'aphront-pager-view-css' => '30ae3b0f',
'aphront-panel-view-css' => '30ae3b0f',
@ -2596,16 +2596,16 @@ celerity_register_resource_map(array(
'aphront-table-view-css' => '30ae3b0f',
'aphront-tokenizer-control-css' => '30ae3b0f',
'aphront-typeahead-control-css' => '30ae3b0f',
'differential-changeset-view-css' => 'e7780f43',
'differential-core-view-css' => 'e7780f43',
'differential-changeset-view-css' => '04b74eea',
'differential-core-view-css' => '04b74eea',
'differential-inline-comment-editor' => '270dd507',
'differential-local-commits-view-css' => 'e7780f43',
'differential-revision-add-comment-css' => 'e7780f43',
'differential-revision-comment-css' => 'e7780f43',
'differential-revision-comment-list-css' => 'e7780f43',
'differential-revision-detail-css' => 'e7780f43',
'differential-revision-history-css' => 'e7780f43',
'differential-table-of-contents-css' => 'e7780f43',
'differential-local-commits-view-css' => '04b74eea',
'differential-revision-add-comment-css' => '04b74eea',
'differential-revision-comment-css' => '04b74eea',
'differential-revision-comment-list-css' => '04b74eea',
'differential-revision-detail-css' => '04b74eea',
'differential-revision-history-css' => '04b74eea',
'differential-table-of-contents-css' => '04b74eea',
'diffusion-commit-view-css' => '4ccda8a6',
'javelin-behavior' => '4fbae2af',
'javelin-behavior-aphront-basic-tokenizer' => '2af849fb',
@ -2653,7 +2653,7 @@ celerity_register_resource_map(array(
'maniphest-task-summary-css' => '8db30c56',
'maniphest-transaction-detail-css' => '8db30c56',
'phabricator-app-buttons-css' => '30ae3b0f',
'phabricator-content-source-view-css' => 'e7780f43',
'phabricator-content-source-view-css' => '04b74eea',
'phabricator-core-buttons-css' => '30ae3b0f',
'phabricator-core-css' => '30ae3b0f',
'phabricator-directory-css' => '30ae3b0f',
@ -2663,7 +2663,7 @@ celerity_register_resource_map(array(
'phabricator-keyboard-shortcut' => '21d01ed8',
'phabricator-keyboard-shortcut-manager' => '21d01ed8',
'phabricator-menu-item' => '21d01ed8',
'phabricator-object-selector-css' => 'e7780f43',
'phabricator-object-selector-css' => '04b74eea',
'phabricator-paste-file-upload' => '21d01ed8',
'phabricator-remarkup-css' => '30ae3b0f',
'phabricator-shaped-request' => '270dd507',

View file

@ -354,6 +354,8 @@ final class DiffusionBrowseFileController extends DiffusionController {
$request = $this->getRequest();
$user = $request->getUser();
Javelin::initBehavior('phabricator-oncopy', array());
$rows = array();
foreach ($display as $line) {
@ -475,7 +477,9 @@ final class DiffusionBrowseFileController extends DiffusionController {
'td',
array(
),
$anchor_text.$line['data']);
$anchor_text.
"\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior.
$line['data']);
$rows[] = phutil_render_tag(
'tr',

View file

@ -149,6 +149,9 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
Javelin::initBehavior('phabricator-oncopy', array());
$rows = $this->buildDisplayRows($text_list);
// TODO: Split the "one-up source listing" view into its own class and
// share it properly between Paste and Diffusion.
$corpus_table = phutil_render_tag(
'table',
array(
@ -183,7 +186,13 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
'href' => '#'.$anchor,
),
$n);
$rows[] = '<tr id="'.$anchor.'"><th>'.$link.'</th>'.
$link = phutil_render_tag(
'th',
array(
'class' => 'diffusion-line-link',
),
$link);
$rows[] = '<tr id="'.$anchor.'">'.$link.
'<td style="white-space: pre-wrap;">'.
// NOTE: See the 'phabricator-oncopy' behavior.
"\xE2\x80\x8B".

View file

@ -55,6 +55,12 @@
font-family: "Verdana";
font-size: 11px;
overflow: hidden;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.differential-changeset-immutable .differential-diff th {

View file

@ -58,3 +58,11 @@
.diffusion-author-link span {
padding: 2px 8px;
}
.diffusion-line-link {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}