Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15360986
D19349.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D19349.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -119,7 +119,7 @@
'rsrc/css/font/font-lato.css' => 'c7ccd872',
'rsrc/css/font/phui-font-icon-base.css' => '870a7360',
'rsrc/css/layout/phabricator-filetree-view.css' => 'b912ad97',
- 'rsrc/css/layout/phabricator-source-code-view.css' => 'c5edc888',
+ 'rsrc/css/layout/phabricator-source-code-view.css' => '09368218',
'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494',
'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68',
'rsrc/css/phui/button/phui-button.css' => '1863cc6e',
@@ -471,7 +471,7 @@
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a',
- 'rsrc/js/core/behavior-line-linker.js' => '69837bed',
+ 'rsrc/js/core/behavior-line-linker.js' => '36165eb1',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0',
'rsrc/js/core/behavior-oncopy.js' => '2926fff2',
@@ -634,7 +634,7 @@
'javelin-behavior-phabricator-gesture-example' => '558829c2',
'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0',
'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0',
- 'javelin-behavior-phabricator-line-linker' => '69837bed',
+ 'javelin-behavior-phabricator-line-linker' => '36165eb1',
'javelin-behavior-phabricator-nav' => '94b7c320',
'javelin-behavior-phabricator-notification-example' => '8ce821c5',
'javelin-behavior-phabricator-object-selector' => '77c1f0b0',
@@ -780,7 +780,7 @@
'phabricator-search-results-css' => '505dd8cf',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-slowvote-css' => 'a94b7230',
- 'phabricator-source-code-view-css' => 'c5edc888',
+ 'phabricator-source-code-view-css' => '09368218',
'phabricator-standard-page-view' => '34ee718b',
'phabricator-textareautils' => '320810c8',
'phabricator-title' => '485aaa6c',
@@ -1098,6 +1098,12 @@
'javelin-dom',
'javelin-vector',
),
+ '36165eb1' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-history',
+ ),
'3ab51e2c' => array(
'javelin-behavior',
'javelin-behavior-device',
@@ -1407,12 +1413,6 @@
'javelin-dom',
'phuix-button-view',
),
- '69837bed' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-history',
- ),
'69adf288' => array(
'javelin-install',
),
diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php
--- a/src/view/layout/PhabricatorSourceCodeView.php
+++ b/src/view/layout/PhabricatorSourceCodeView.php
@@ -66,7 +66,6 @@
require_celerity_resource('phabricator-source-code-view-css');
require_celerity_resource('syntax-highlighting-css');
- Javelin::initBehavior('phabricator-oncopy', array());
if ($this->canClickHighlight) {
Javelin::initBehavior('phabricator-line-linker');
}
@@ -78,11 +77,11 @@
$lines = $this->lines;
if ($this->truncatedFirstLines) {
$lines[] = phutil_tag(
- 'span',
- array(
- 'class' => 'c',
- ),
- pht('...'));
+ 'span',
+ array(
+ 'class' => 'c',
+ ),
+ pht('...'));
} else if ($this->truncatedFirstBytes) {
$last_key = last_key($lines);
$lines[$last_key] = hsprintf(
@@ -98,9 +97,6 @@
$base_uri = (string)$this->uri;
foreach ($lines as $line) {
- // NOTE: See phabricator-oncopy behavior.
- $content_line = hsprintf("\xE2\x80\x8B%s", $line);
-
$row_attributes = array();
if (isset($this->highlights[$line_number])) {
$row_attributes['class'] = 'phabricator-source-highlight';
@@ -117,8 +113,8 @@
'a',
array(
'href' => $line_href,
- ),
- $line_number);
+ 'data-n' => $line_number,
+ ));
} else {
$tag_number = phutil_tag(
'span',
@@ -172,7 +168,7 @@
array(
'class' => 'phabricator-source-code',
),
- $content_line),
+ $line),
));
$line_number++;
diff --git a/webroot/rsrc/css/layout/phabricator-source-code-view.css b/webroot/rsrc/css/layout/phabricator-source-code-view.css
--- a/webroot/rsrc/css/layout/phabricator-source-code-view.css
+++ b/webroot/rsrc/css/layout/phabricator-source-code-view.css
@@ -25,16 +25,11 @@
text-align: right;
border-right: 1px solid {$paste.border};
color: {$sh-yellowtext};
+}
- /* When the user selects rows of source, don't visibly select the line
- numbers beside them. We use JS to strip the line numbers out when the user
- copies the text. */
- -moz-user-select: -moz-none;
- -khtml-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- user-select: none;
- white-space: nowrap;
+.phabricator-source-line > a::before {
+ /* Render the line numbers as a pseudo-element so they don't get copied. */
+ content: attr(data-n);
}
th.phabricator-source-line a,
diff --git a/webroot/rsrc/js/core/behavior-line-linker.js b/webroot/rsrc/js/core/behavior-line-linker.js
--- a/webroot/rsrc/js/core/behavior-line-linker.js
+++ b/webroot/rsrc/js/core/behavior-line-linker.js
@@ -29,7 +29,7 @@
}
}
- return +(th.textContent || th.innerText);
+ return null;
}
JX.Stratcom.listen(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 11:16 AM (6 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7584431
Default Alt Text
D19349.diff (5 KB)
Attached To
Mode
D19349: Use pseudoelements, not Zero Width Space, to implement copy/paste behavior in Paste/Diffusion
Attached
Detach File
Event Timeline
Log In to Comment