2015-11-23 22:28:57 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface MWPreviewElement class.
|
|
|
|
*
|
2017-01-03 16:58:33 +00:00
|
|
|
* @copyright 2011-2017 VisualEditor Team and others; see AUTHORS.txt
|
2015-11-23 22:28:57 +00:00
|
|
|
* @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
|
2017-11-10 14:59:01 +00:00
|
|
|
this.$element.addClass( 've-ui-mwPreviewElement mw-body-content mw-parser-output' );
|
2015-11-23 22:28:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWPreviewElement, ve.ui.PreviewElement );
|
2017-03-24 18:52:12 +00:00
|
|
|
|
|
|
|
/* Method */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWPreviewElement.prototype.replaceWithModelDom = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWPreviewElement.super.prototype.replaceWithModelDom.apply( this, arguments );
|
|
|
|
|
2017-03-30 16:37:54 +00:00
|
|
|
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()
|
|
|
|
);
|
2017-03-24 18:52:12 +00:00
|
|
|
};
|