2014-10-15 23:56:44 +00:00
|
|
|
/*!
|
2015-07-18 21:42:09 +00:00
|
|
|
* VisualEditor UserInterface MWTargetWidget class.
|
2014-10-15 23:56:44 +00:00
|
|
|
*
|
2020-01-08 17:13:04 +00:00
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
2014-10-15 23:56:44 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-07-18 21:42:09 +00:00
|
|
|
* Creates an ve.ui.MWTargetWidget object.
|
2014-10-15 23:56:44 +00:00
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
2015-07-18 21:42:09 +00:00
|
|
|
* @extends ve.ui.TargetWidget
|
2014-10-15 23:56:44 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
2016-11-20 22:53:34 +00:00
|
|
|
ve.ui.MWTargetWidget = function VeUiMWTargetWidget() {
|
2014-10-15 23:56:44 +00:00
|
|
|
// Parent constructor
|
2016-11-20 22:53:34 +00:00
|
|
|
ve.ui.MWTargetWidget.super.apply( this, arguments );
|
2014-10-15 23:56:44 +00:00
|
|
|
|
|
|
|
// Initialization
|
2015-07-18 21:42:09 +00:00
|
|
|
this.$element.addClass( 've-ui-mwTargetWidget' );
|
2014-10-15 23:56:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2015-07-18 21:42:09 +00:00
|
|
|
OO.inheritClass( ve.ui.MWTargetWidget, ve.ui.TargetWidget );
|
2016-11-20 22:53:34 +00:00
|
|
|
|
2019-10-09 13:55:40 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWTargetWidget.prototype.createTarget = function () {
|
|
|
|
return new ve.init.mw.Target( {
|
|
|
|
register: false,
|
|
|
|
toolbarGroups: this.toolbarGroups,
|
|
|
|
inTargetWidget: true,
|
|
|
|
modes: this.modes,
|
|
|
|
defaultMode: this.defaultMode
|
|
|
|
} );
|
|
|
|
};
|
|
|
|
|
2016-11-20 22:53:34 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWTargetWidget.prototype.setDocument = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWTargetWidget.super.prototype.setDocument.apply( this, arguments );
|
|
|
|
|
|
|
|
// Add MW specific classes to the surface
|
2019-10-09 13:55:40 +00:00
|
|
|
this.getSurface().getView().$element.addClass( 'mw-body-content' );
|
|
|
|
this.getSurface().$placeholder.addClass( 'mw-body-content' );
|
2016-11-20 22:53:34 +00:00
|
|
|
};
|