2018-05-05 15:42:34 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface MWSurface class.
|
|
|
|
*
|
2019-01-01 13:24:23 +00:00
|
|
|
* @copyright 2011-2019 VisualEditor Team and others; see http://ve.mit-license.org
|
2018-05-05 15:42:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.Surface
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {HTMLDocument|Array|ve.dm.LinearData|ve.dm.Document} dataOrDoc Document data to edit
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWSurface = function VeUiMWSurface() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWSurface.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Events
|
|
|
|
this.getView().getDocument().connect( this, { langChange: 'onDocumentViewLangChange' } );
|
|
|
|
|
|
|
|
// DOM changes
|
|
|
|
this.onDocumentViewLangChange();
|
|
|
|
this.$element.addClass( 've-ui-mwSurface' );
|
|
|
|
// T164790
|
2019-02-13 13:20:46 +00:00
|
|
|
this.getView().$attachedRootNode.addClass( 'mw-parser-output' );
|
2018-05-05 15:42:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWSurface, ve.ui.Surface );
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle document view langChange events
|
|
|
|
*/
|
|
|
|
ve.ui.MWSurface.prototype.onDocumentViewLangChange = function () {
|
|
|
|
// Add appropriately mw-content-ltr or mw-content-rtl class
|
2019-02-13 13:20:46 +00:00
|
|
|
this.getView().$attachedRootNode
|
2018-05-05 15:42:34 +00:00
|
|
|
.removeClass( 'mw-content-ltr mw-content-rtl' )
|
|
|
|
.addClass( 'mw-content-' + this.getView().getDocument().getDir() );
|
|
|
|
};
|