mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
3c293ea00c
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWPreviewElement class.
|
|
*
|
|
* @copyright 2011-2019 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.MWPreviewElement object.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.PreviewElement
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.Node} [model]
|
|
* @param {Object} [config]
|
|
*/
|
|
ve.ui.MWPreviewElement = function VeUiMwPreviewElement() {
|
|
// Parent constructor
|
|
ve.ui.MWPreviewElement.super.apply( this, arguments );
|
|
|
|
// Initialize
|
|
this.$element.addClass( 've-ui-mwPreviewElement mw-body-content mw-parser-output' );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
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
|
|
*/
|
|
ve.ui.MWPreviewElement.prototype.replaceWithModelDom = function () {
|
|
// Parent method
|
|
ve.ui.MWPreviewElement.super.prototype.replaceWithModelDom.apply( this, arguments );
|
|
|
|
ve.init.platform.linkCache.styleParsoidElements(
|
|
this.$element,
|
|
// The DM node should be attached, but check just in case.
|
|
this.model.getDocument() && this.model.getDocument().getHtmlDocument()
|
|
);
|
|
};
|