mediawiki-extensions-Visual.../modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js
James D. Forrester 8463524e18 MWSaveDialog: Run links through a render function for preview & visual diff
Provide a utility funcition in ve.init.mw.LinkCache to do this.

Also use this in ve.ce.MWTransclusionNode/ve.ui.MWPreviewElement, and
introduce to ve.ce.MWExtenionNode

Bug: T73900
Bug: T153535
Change-Id: Ieb9a0274b8c5ae1932c431546f09d18000fa6dd9
2017-03-31 10:51:35 +01:00

45 lines
1.1 KiB
JavaScript

/*!
* VisualEditor UserInterface MWPreviewElement class.
*
* @copyright 2011-2017 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' );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWPreviewElement, ve.ui.PreviewElement );
/* Method */
/**
* @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()
);
};