Kind-of-terrible (?) oncopy handler
Summary: Works in Safari, Firefox, Chrome. Test Plan: Copied some text, threw up a little in my mouth. Reviewers: aran, tuomaspelkonen, tomo, rstout, btrahan Reviewed By: aran CC: aran, epriestley, ddfisher Maniphest Tasks: T145, T995 Differential Revision: https://secure.phabricator.com/D244
This commit is contained in:
@@ -839,6 +839,17 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'disk' => '/rsrc/js/application/core/behavior-object-selector.js',
|
||||
),
|
||||
'javelin-behavior-phabricator-oncopy' =>
|
||||
array(
|
||||
'uri' => '/res/70b9b75e/rsrc/js/application/core/behavior-oncopy.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
1 => 'javelin-dom',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/core/behavior-oncopy.js',
|
||||
),
|
||||
'javelin-behavior-phabricator-tooltips' =>
|
||||
array(
|
||||
'uri' => '/res/49f92a92/rsrc/js/application/core/behavior-tooltip.js',
|
||||
|
||||
@@ -1417,7 +1417,10 @@ final class DifferentialChangesetParser {
|
||||
'<th'.$o_id.'>'.$o_num.'</th>'.
|
||||
'<td'.$o_attr.'>'.$o_text.'</td>'.
|
||||
'<th'.$n_id.'>'.$n_num.'</th>'.
|
||||
'<td'.$n_attr.'>'.$n_text.'</td>'.
|
||||
// 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.
|
||||
'<td'.$n_attr.'>'."\xE2\x80\x8B".$n_text.'</td>'.
|
||||
$n_cov.
|
||||
'</tr>';
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ final class DifferentialChangesetDetailView extends AphrontView {
|
||||
require_celerity_resource('differential-changeset-view-css');
|
||||
require_celerity_resource('syntax-highlighting-css');
|
||||
|
||||
Javelin::initBehavior('phabricator-oncopy', array());
|
||||
|
||||
if ($this->revisionID) {
|
||||
$edit = true;
|
||||
} else {
|
||||
|
||||
@@ -142,6 +142,7 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
|
||||
|
||||
$text_list = explode("\n", $source);
|
||||
|
||||
Javelin::initBehavior('phabricator-oncopy', array());
|
||||
$rows = $this->buildDisplayRows($text_list);
|
||||
|
||||
$corpus_table = phutil_render_tag(
|
||||
@@ -179,7 +180,10 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
|
||||
),
|
||||
$n);
|
||||
$rows[] = '<tr id="'.$anchor.'"><th>'.$link.'</th>'.
|
||||
'<td style="white-space: pre-wrap;">'.$line.'</td></tr>';
|
||||
'<td style="white-space: pre-wrap;">'.
|
||||
// NOTE: See the 'phabricator-oncopy' behavior.
|
||||
"\xE2\x80\x8B".
|
||||
$line.'</td></tr>';
|
||||
++$n;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
phutil_require_module('phabricator', 'applications/paste/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/paste/storage/paste');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user