Allow configuration of the default monospaced font style
Summary: This is a fairly contentious default that we can easily move to configuration. Test Plan: Changed the default, changed my user setting, reverted my user setting, verified the "settings" page. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D2935
This commit is contained in:
@@ -59,6 +59,9 @@ EXAMPLE;
|
||||
),
|
||||
'User Guide: Configuring an External Editor');
|
||||
|
||||
$font_default = PhabricatorEnv::getEnvConfig('style.monospace');
|
||||
$font_default = phutil_escape_html($font_default);
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->setAction('/settings/page/preferences/')
|
||||
@@ -90,8 +93,7 @@ EXAMPLE;
|
||||
->setName($pref_monospaced)
|
||||
->setCaption(
|
||||
'Overrides default fonts in tools like Differential. '.
|
||||
'(Default: 10px "Menlo", "Consolas", "Monaco", '.
|
||||
'monospace)')
|
||||
'(Default: '.$font_default.')')
|
||||
->setValue($preferences->getPreference($pref_monospaced)))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
|
||||
@@ -209,33 +209,31 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
||||
}
|
||||
|
||||
$response = CelerityAPI::getStaticResourceResponse();
|
||||
|
||||
$monospaced = PhabricatorEnv::getEnvConfig('style.monospace');
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request) {
|
||||
$user = $request->getUser();
|
||||
if ($user) {
|
||||
$monospaced = nonempty(
|
||||
$user->loadPreferences()->getPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_MONOSPACED),
|
||||
$monospaced);
|
||||
}
|
||||
}
|
||||
|
||||
$head =
|
||||
'<script type="text/javascript">'.
|
||||
$framebust.
|
||||
'window.__DEV__=1;'.
|
||||
'</script>'.
|
||||
$response->renderResourcesOfType('css').
|
||||
'<style type="text/css">'.
|
||||
'.PhabricatorMonospaced { font: '.$monospaced.'; }'.
|
||||
'</style>'.
|
||||
$response->renderSingleResource('javelin-magical-init');
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request) {
|
||||
$user = $request->getUser();
|
||||
if ($user) {
|
||||
$monospaced = $user->loadPreferences()->getPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_MONOSPACED
|
||||
);
|
||||
|
||||
if (strlen($monospaced)) {
|
||||
$head .=
|
||||
'<style type="text/css">'.
|
||||
'.PhabricatorMonospaced { font: '.
|
||||
$monospaced.
|
||||
' !important; }'.
|
||||
'</style>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user