1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

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
This commit is contained in:
epriestley 2015-12-22 12:27:51 -08:00
parent f5ff10fe28
commit 8752bd4966
4 changed files with 53 additions and 13 deletions

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'core.pkg.css' => '1a2d5480',
'core.pkg.css' => '357b84b0',
'core.pkg.js' => 'cf262309',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
@ -104,7 +104,7 @@ return array(
'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
'rsrc/css/application/uiexample/example.css' => '528b19de',
'rsrc/css/core/core.css' => 'a76cefc9',
'rsrc/css/core/remarkup.css' => '72024fc6',
'rsrc/css/core/remarkup.css' => '7afb543c',
'rsrc/css/core/syntax.css' => '9fd11da8',
'rsrc/css/core/z-index.css' => '57ddcaa2',
'rsrc/css/diviner/diviner-shared.css' => 'aa3656aa',
@ -427,7 +427,7 @@ return array(
'rsrc/js/application/repository/repository-crossreference.js' => 'e5339c43',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'bb0d2d0c',
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'd885b622',
'rsrc/js/application/transactions/behavior-reorder-configs.js' => 'd7a74243',
'rsrc/js/application/transactions/behavior-reorder-fields.js' => 'b59e1e96',
'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6',
@ -572,7 +572,7 @@ return array(
'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-bulk-job-reload' => 'edf8a145',
'javelin-behavior-choose-control' => 'dfaafb14',
'javelin-behavior-comment-actions' => 'bb0d2d0c',
'javelin-behavior-comment-actions' => 'd885b622',
'javelin-behavior-config-reorder-fields' => 'b6993408',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
'javelin-behavior-conpherence-menu' => '1d45c74d',
@ -759,7 +759,7 @@ return array(
'phabricator-object-selector-css' => '85ee8ce6',
'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => '666c80c5',
'phabricator-remarkup-css' => '72024fc6',
'phabricator-remarkup-css' => '7afb543c',
'phabricator-search-results-css' => '7dea472c',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-side-menu-view-css' => 'bec2458e',
@ -1740,14 +1740,6 @@ return array(
'javelin-workflow',
'phabricator-draggable-list',
),
'bb0d2d0c' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-workflow',
'javelin-dom',
'phuix-form-control-view',
'phuix-icon-view',
),
'bd4c8dca' => array(
'javelin-install',
'javelin-util',
@ -1870,6 +1862,14 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'd885b622' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-workflow',
'javelin-dom',
'phuix-form-control-view',
'phuix-icon-view',
),
'dbbf48b6' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -65,33 +65,43 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
$actions = array(
'fa-bold' => array(
'tip' => pht('Bold'),
'nodevice' => true,
),
'fa-italic' => array(
'tip' => pht('Italics'),
'nodevice' => true,
),
'fa-text-width' => array(
'tip' => pht('Monospaced'),
'nodevice' => true,
),
'fa-link' => array(
'tip' => pht('Link'),
'nodevice' => true,
),
array(
'spacer' => true,
'nodevice' => true,
),
'fa-list-ul' => array(
'tip' => pht('Bulleted List'),
'nodevice' => true,
),
'fa-list-ol' => array(
'tip' => pht('Numbered List'),
'nodevice' => true,
),
'fa-code' => array(
'tip' => pht('Code Block'),
'nodevice' => true,
),
'fa-quote-right' => array(
'tip' => pht('Quote'),
'nodevice' => true,
),
'fa-table' => array(
'tip' => pht('Table'),
'nodevice' => true,
),
'fa-cloud-upload' => array(
'tip' => pht('Upload File'),
@ -155,6 +165,10 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
$classes[] = 'remarkup-assist-right';
}
if (idx($spec, 'nodevice')) {
$classes[] = 'remarkup-assist-nodevice';
}
if (idx($spec, 'spacer')) {
$classes[] = 'remarkup-assist-separator';
$buttons[] = phutil_tag(

View file

@ -556,3 +556,7 @@ var.remarkup-assist-textarea {
.remarkup-assist-button.preview-active:hover .phui-icon-view {
color: {$lightsky};
}
.device .remarkup-assist-nodevice {
display: none;
}

View file

@ -115,6 +115,10 @@ JX.behavior('comment-actions', function(config) {
}
function onresponse(response) {
if (JX.Device.getDevice() != 'desktop') {
return;
}
var panel = JX.$(config.panelID);
if (!response.xactions.length) {
JX.DOM.hide(panel);
@ -152,7 +156,25 @@ JX.behavior('comment-actions', function(config) {
JX.DOM.listen(form_node, 'shouldRefresh', null, always_trigger);
request.start();
var ondevicechange = function() {
var panel = JX.$(config.panelID);
if (JX.Device.getDevice() == 'desktop') {
request.setRateLimit(500);
always_trigger();
} else {
// On mobile, don't show live previews and only save drafts every
// 10 seconds.
request.setRateLimit(10000);
JX.DOM.hide(panel);
}
};
ondevicechange();
JX.Stratcom.listen('phabricator-device-change', null, ondevicechange);
}
restore_draft_actions(config.drafts || []);
});