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:
@@ -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".
|
||||
|
||||
Reference in New Issue
Block a user