From: jenkins-bot Date: Wed, 28 Sep 2016 20:03:38 +0000 (+0000) Subject: Merge "Use classes to apply the 'editfont' preference" X-Git-Tag: 1.31.0-rc.0~5288 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=5e4facec788bd45586c66a04b6fcb26c83f46902;hp=056b6cf68859f55aa8cc03def915d22329a26a56;p=lhc%2Fweb%2Fwiklou.git Merge "Use classes to apply the 'editfont' preference" --- diff --git a/includes/EditPage.php b/includes/EditPage.php index f449283bf5..38f8ab69b2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3300,6 +3300,12 @@ HTML 'id' => $name, 'cols' => $wgUser->getIntOption( 'cols' ), 'rows' => $wgUser->getIntOption( 'rows' ), + // The following classes can be used here: + // * mw-editfont-default + // * mw-editfont-monospace + // * mw-editfont-sans-serif + // * mw-editfont-serif + 'class' => 'mw-editfont-' . $wgUser->getOption( 'editfont' ), // Avoid PHP notices when appending preferences // (appending allows customAttribs['style'] to still work). 'style' => '' diff --git a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php index 4d0bff7949..aef1c74452 100644 --- a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php +++ b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php @@ -55,12 +55,6 @@ class ResourceLoaderUserCSSPrefsModule extends ResourceLoaderModule { $rules[] = "a { text-decoration: " . ( $options['underline'] ? 'underline' : 'none' ) . "; }"; } - if ( $options['editfont'] !== 'default' ) { - // Double-check that $options['editfont'] consists of safe characters only - if ( preg_match( '/^[a-zA-Z0-9_, -]+$/', $options['editfont'] ) ) { - $rules[] = "textarea { font-family: {$options['editfont']}; }\n"; - } - } $style = implode( "\n", $rules ); if ( $this->getFlip( $context ) ) { $style = CSSJanus::transform( $style, true, false ); diff --git a/resources/src/mediawiki.legacy/shared.css b/resources/src/mediawiki.legacy/shared.css index cb4919ff39..1522de1e75 100644 --- a/resources/src/mediawiki.legacy/shared.css +++ b/resources/src/mediawiki.legacy/shared.css @@ -105,6 +105,25 @@ span.comment { clear: both; } +/* Edit font preference */ +/* TODO: for 'default' on non-textareas we could compute the default font of textarea in the client */ +.mw-editfont-default:not( textarea ) { + font-family: monospace; +} + +/* Keep this rule separate from the :not rule above so it still works in older browsers */ +.mw-editfont-monospace { + font-family: monospace; +} + +.mw-editfont-sans-serif { + font-family: sans-serif; +} + +.mw-editfont-serif { + font-family: serif; +} + /** * rev_deleted stuff */