1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Switch back to zwsp for oncopy line marker

Summary:
Fixes T4759.

Turns out Chrome on windows doesn't really like the word joiner character. We'll switch back to zwsp but make it `position: absolute;` so it doesn't turn into a line break.

Test Plan: Looked at diffs in IE9 and Chrome Windows. Made sure copying still works as expected.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4759

Differential Revision: https://secure.phabricator.com/D8727
This commit is contained in:
Ben Alpert 2014-04-08 17:55:48 -07:00 committed by epriestley
parent 563a1ac5bf
commit a7272dfb03
6 changed files with 27 additions and 20 deletions

View file

@ -8,9 +8,9 @@ return array(
'names' =>
array(
'core.pkg.css' => 'ab5dd633',
'core.pkg.js' => '68839013',
'core.pkg.js' => 'c5b39816',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '9578e86b',
'differential.pkg.css' => '12c11318',
'differential.pkg.js' => '11a5b750',
'diffusion.pkg.css' => '3783278d',
'diffusion.pkg.js' => '5b4010f4',
@ -55,7 +55,7 @@ return array(
'rsrc/css/application/countdown/timer.css' => '86b7b0a0',
'rsrc/css/application/diff/inline-comment-summary.css' => '14a91639',
'rsrc/css/application/differential/add-comment.css' => 'c478bcaa',
'rsrc/css/application/differential/changeset-view.css' => '6a0299e9',
'rsrc/css/application/differential/changeset-view.css' => '1570a1ff',
'rsrc/css/application/differential/core.css' => '7ac3cabc',
'rsrc/css/application/differential/results-table.css' => '239924f9',
'rsrc/css/application/differential/revision-comment.css' => '48186045',
@ -463,7 +463,7 @@ return array(
'rsrc/js/core/behavior-line-linker.js' => 'bc778103',
'rsrc/js/core/behavior-more.js' => '9b9197be',
'rsrc/js/core/behavior-object-selector.js' => 'b4eef37b',
'rsrc/js/core/behavior-oncopy.js' => 'e69e4400',
'rsrc/js/core/behavior-oncopy.js' => 'c3e218fe',
'rsrc/js/core/behavior-phabricator-nav.js' => 'b5842a5e',
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'c021950a',
'rsrc/js/core/behavior-refresh-csrf.js' => 'c4b31646',
@ -505,7 +505,7 @@ return array(
'conpherence-notification-css' => '403cf598',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => '87b12e0c',
'differential-changeset-view-css' => '6a0299e9',
'differential-changeset-view-css' => '1570a1ff',
'differential-core-view-css' => '7ac3cabc',
'differential-inline-comment-editor' => 'f2441746',
'differential-results-table-css' => '239924f9',
@ -596,7 +596,7 @@ return array(
'javelin-behavior-phabricator-nav' => 'b5842a5e',
'javelin-behavior-phabricator-notification-example' => 'c51a6616',
'javelin-behavior-phabricator-object-selector' => 'b4eef37b',
'javelin-behavior-phabricator-oncopy' => 'e69e4400',
'javelin-behavior-phabricator-oncopy' => 'c3e218fe',
'javelin-behavior-phabricator-remarkup-assist' => 'c021950a',
'javelin-behavior-phabricator-reveal-content' => '8f24abfc',
'javelin-behavior-phabricator-search-typeahead' => 'f6b56f7a',
@ -1635,6 +1635,11 @@ return array(
2 => 'javelin-util',
3 => 'javelin-magical-init',
),
'c3e218fe' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
'c4b31646' =>
array(
0 => 'javelin-request',
@ -1810,11 +1815,6 @@ return array(
2 => 'javelin-view-visitor',
3 => 'javelin-util',
),
'e69e4400' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
'e7c21fb3' =>
array(
0 => 'javelin-dom',

View file

@ -284,11 +284,10 @@ final class DifferentialChangesetTwoUpRenderer
$n_id = null;
}
// NOTE: This is a unicode 'word joiner' (essentially a non-breaking
// zero-width space), which we use as a hint when intercepting 'copy'
// events to make sure sensible text ends up on the clipboard.
// See the 'phabricator-oncopy' behavior.
$zero_space = "\xE2\x81\xA0";
// NOTE: This is a unicode zero-width space, which we use as a hint when
// intercepting 'copy' events to make sure sensible text ends up on the
// clipboard. See the 'phabricator-oncopy' behavior.
$zero_space = "\xE2\x80\x8B";
// NOTE: The Javascript is sensitive to whitespace changes in this
// block!
@ -301,7 +300,10 @@ final class DifferentialChangesetTwoUpRenderer
phutil_tag(
'td',
array('class' => $n_classes, 'colspan' => $n_colspan),
array($zero_space, $n_text)),
array(
phutil_tag('span', array('class' => 'zwsp'), $zero_space),
$n_text
)),
$n_cov,
));

View file

@ -789,7 +789,7 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
$anchor_text,
// NOTE: See phabricator-oncopy behavior.
"\xE2\x81\xA0",
"\xE2\x80\x8B",
// TODO: [HTML] Not ideal.
phutil_safe_html(str_replace("\t", ' ', $line['data'])),

View file

@ -62,7 +62,7 @@ final class PhabricatorSourceCodeView extends AphrontView {
} else {
$content_number = $line_number;
// NOTE: See phabricator-oncopy behavior.
$content_line = hsprintf("\xE2\x81\xA0%s", $line);
$content_line = hsprintf("\xE2\x80\x8B%s", $line);
}
$row_attributes = array();

View file

@ -59,6 +59,11 @@
line-height: 16px;
}
.differential-diff td .zwsp {
position: absolute;
width: 0;
}
.differential-diff th {
text-align: right;
padding: 2px 6px 0px 0px;

View file

@ -16,7 +16,7 @@
*/
JX.behavior('phabricator-oncopy', function() {
var zws = "\u2060"; // Unicode Word Joiner (Non-Breaking Zero-Width Space)
var zws = "\u200B"; // Unicode Zero-Width Space
JX.enableDispatch(document.body, 'copy');
JX.Stratcom.listen(