Skip to content

Commit 8752bd4

Browse files
author
epriestley
committedDec 22, 2015
Disable live previews on mobile
Summary: Fixes T1895. Now that we have on-demand prviews, we can use them on mobile. On mobile: - don't show live previews; - only save drafts every 10 seconds. Also, show fewer remarkup buttons on mobile to try to make sure the more important ones (preview, e.g.) fit. Test Plan: - Made window narrower and wider to trigger preview/no-preview behavior. - Used DarkConsole to verify request rate. Reviewers: chad Reviewed By: chad Maniphest Tasks: T1895 Differential Revision: https://secure.phabricator.com/D14856
1 parent f5ff10f commit 8752bd4

File tree

4 files changed

+53
-13
lines changed

4 files changed

+53
-13
lines changed
 

‎resources/celerity/map.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'core.pkg.css' => '1a2d5480',
10+
'core.pkg.css' => '357b84b0',
1111
'core.pkg.js' => 'cf262309',
1212
'darkconsole.pkg.js' => 'e7393ebb',
1313
'differential.pkg.css' => '2de124c9',
@@ -104,7 +104,7 @@
104104
'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
105105
'rsrc/css/application/uiexample/example.css' => '528b19de',
106106
'rsrc/css/core/core.css' => 'a76cefc9',
107-
'rsrc/css/core/remarkup.css' => '72024fc6',
107+
'rsrc/css/core/remarkup.css' => '7afb543c',
108108
'rsrc/css/core/syntax.css' => '9fd11da8',
109109
'rsrc/css/core/z-index.css' => '57ddcaa2',
110110
'rsrc/css/diviner/diviner-shared.css' => 'aa3656aa',
@@ -427,7 +427,7 @@
427427
'rsrc/js/application/repository/repository-crossreference.js' => 'e5339c43',
428428
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
429429
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
430-
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'bb0d2d0c',
430+
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'd885b622',
431431
'rsrc/js/application/transactions/behavior-reorder-configs.js' => 'd7a74243',
432432
'rsrc/js/application/transactions/behavior-reorder-fields.js' => 'b59e1e96',
433433
'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6',
@@ -572,7 +572,7 @@
572572
'javelin-behavior-audit-preview' => 'd835b03a',
573573
'javelin-behavior-bulk-job-reload' => 'edf8a145',
574574
'javelin-behavior-choose-control' => 'dfaafb14',
575-
'javelin-behavior-comment-actions' => 'bb0d2d0c',
575+
'javelin-behavior-comment-actions' => 'd885b622',
576576
'javelin-behavior-config-reorder-fields' => 'b6993408',
577577
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
578578
'javelin-behavior-conpherence-menu' => '1d45c74d',
@@ -759,7 +759,7 @@
759759
'phabricator-object-selector-css' => '85ee8ce6',
760760
'phabricator-phtize' => 'd254d646',
761761
'phabricator-prefab' => '666c80c5',
762-
'phabricator-remarkup-css' => '72024fc6',
762+
'phabricator-remarkup-css' => '7afb543c',
763763
'phabricator-search-results-css' => '7dea472c',
764764
'phabricator-shaped-request' => '7cbe244b',
765765
'phabricator-side-menu-view-css' => 'bec2458e',
@@ -1740,14 +1740,6 @@
17401740
'javelin-workflow',
17411741
'phabricator-draggable-list',
17421742
),
1743-
'bb0d2d0c' => array(
1744-
'javelin-behavior',
1745-
'javelin-stratcom',
1746-
'javelin-workflow',
1747-
'javelin-dom',
1748-
'phuix-form-control-view',
1749-
'phuix-icon-view',
1750-
),
17511743
'bd4c8dca' => array(
17521744
'javelin-install',
17531745
'javelin-util',
@@ -1870,6 +1862,14 @@
18701862
'javelin-util',
18711863
'phabricator-shaped-request',
18721864
),
1865+
'd885b622' => array(
1866+
'javelin-behavior',
1867+
'javelin-stratcom',
1868+
'javelin-workflow',
1869+
'javelin-dom',
1870+
'phuix-form-control-view',
1871+
'phuix-icon-view',
1872+
),
18731873
'dbbf48b6' => array(
18741874
'javelin-behavior',
18751875
'javelin-stratcom',

‎src/view/form/control/PhabricatorRemarkupControl.php

+14
Original file line numberDiff line numberDiff line change
@@ -65,33 +65,43 @@ protected function renderInput() {
6565
$actions = array(
6666
'fa-bold' => array(
6767
'tip' => pht('Bold'),
68+
'nodevice' => true,
6869
),
6970
'fa-italic' => array(
7071
'tip' => pht('Italics'),
72+
'nodevice' => true,
7173
),
7274
'fa-text-width' => array(
7375
'tip' => pht('Monospaced'),
76+
'nodevice' => true,
7477
),
7578
'fa-link' => array(
7679
'tip' => pht('Link'),
80+
'nodevice' => true,
7781
),
7882
array(
7983
'spacer' => true,
84+
'nodevice' => true,
8085
),
8186
'fa-list-ul' => array(
8287
'tip' => pht('Bulleted List'),
88+
'nodevice' => true,
8389
),
8490
'fa-list-ol' => array(
8591
'tip' => pht('Numbered List'),
92+
'nodevice' => true,
8693
),
8794
'fa-code' => array(
8895
'tip' => pht('Code Block'),
96+
'nodevice' => true,
8997
),
9098
'fa-quote-right' => array(
9199
'tip' => pht('Quote'),
100+
'nodevice' => true,
92101
),
93102
'fa-table' => array(
94103
'tip' => pht('Table'),
104+
'nodevice' => true,
95105
),
96106
'fa-cloud-upload' => array(
97107
'tip' => pht('Upload File'),
@@ -155,6 +165,10 @@ protected function renderInput() {
155165
$classes[] = 'remarkup-assist-right';
156166
}
157167

168+
if (idx($spec, 'nodevice')) {
169+
$classes[] = 'remarkup-assist-nodevice';
170+
}
171+
158172
if (idx($spec, 'spacer')) {
159173
$classes[] = 'remarkup-assist-separator';
160174
$buttons[] = phutil_tag(

‎webroot/rsrc/css/core/remarkup.css

+4
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,7 @@ var.remarkup-assist-textarea {
556556
.remarkup-assist-button.preview-active:hover .phui-icon-view {
557557
color: {$lightsky};
558558
}
559+
560+
.device .remarkup-assist-nodevice {
561+
display: none;
562+
}

‎webroot/rsrc/js/application/transactions/behavior-comment-actions.js

+22
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ JX.behavior('comment-actions', function(config) {
115115
}
116116

117117
function onresponse(response) {
118+
if (JX.Device.getDevice() != 'desktop') {
119+
return;
120+
}
121+
118122
var panel = JX.$(config.panelID);
119123
if (!response.xactions.length) {
120124
JX.DOM.hide(panel);
@@ -152,7 +156,25 @@ JX.behavior('comment-actions', function(config) {
152156

153157
JX.DOM.listen(form_node, 'shouldRefresh', null, always_trigger);
154158
request.start();
159+
160+
var ondevicechange = function() {
161+
var panel = JX.$(config.panelID);
162+
if (JX.Device.getDevice() == 'desktop') {
163+
request.setRateLimit(500);
164+
always_trigger();
165+
} else {
166+
// On mobile, don't show live previews and only save drafts every
167+
// 10 seconds.
168+
request.setRateLimit(10000);
169+
JX.DOM.hide(panel);
170+
}
171+
};
172+
173+
ondevicechange();
174+
175+
JX.Stratcom.listen('phabricator-device-change', null, ondevicechange);
155176
}
156177

157178
restore_draft_actions(config.drafts || []);
179+
158180
});

0 commit comments

Comments
 (0)
Failed to load comments.