Add missing mw-content-(dir) class to MWPreviewElement

Also allow preview elements to existing with an mw-body-content
area withouth the font size being applied twice.

Depends-On: Ibbf989dcebf2d21fd2ac481f17062f366ff29e41
Change-Id: I284bcd5dd25cdbb883427ebacb41af1bbf50b60f
This commit is contained in:
Ed Sanders 2018-05-11 14:50:58 +01:00 committed by Jforrester
parent 99a226020e
commit 60e129062a
3 changed files with 22 additions and 0 deletions

View file

@ -1318,6 +1318,7 @@
"modules/ve-mw/ui/styles/inspectors/ve.ui.MWExtensionInspector.css",
"modules/ve-mw/ui/styles/inspectors/ve.ui.MWLiveExtensionInspector.css",
"modules/ve-mw/ui/styles/elements/ve.ui.MWExpandableErrorElement.css",
"modules/ve-mw/ui/styles/elements/ve.ui.MWPreviewElement.css",
"modules/ve-mw/ui/styles/tools/ve.ui.MWPopupTool.css",
"modules/ve-mw/ui/styles/widgets/ve.ui.MWAceEditorWidget.css",
"modules/ve-mw/ui/styles/tools/ve.ui.MWEducationPopupTool.css"

View file

@ -29,6 +29,16 @@ OO.inheritClass( ve.ui.MWPreviewElement, ve.ui.PreviewElement );
/* Method */
/**
* @inheritdoc
*/
ve.ui.MWPreviewElement.prototype.setModel = function ( model ) {
// Parent method
ve.ui.MWPreviewElement.super.prototype.setModel.call( this, model );
this.$element.addClass( 'mw-content-' + this.model.getDocument().getDir() );
};
/**
* @inheritdoc
*/

View file

@ -0,0 +1,11 @@
/*!
* VisualEditor MediaWiki UserInterface preview element styles.
*
* @copyright 2011-2018 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
.mw-body-content .ve-ui-mwPreviewElement {
/* Don't apply font adjustment twice if already inside a content area */
font-size: inherit;
}