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
|
2021-09-11 08:05:31 +00:00
|
|
|
* @param {Object} config
|
2021-05-17 21:39:22 +00:00
|
|
|
* @cfg {string[]} [surfaceClasses] Surface classes to apply
|
2014-10-15 23:56:44 +00:00
|
|
|
*/
|
2021-05-17 21:39:22 +00:00
|
|
|
ve.ui.MWTargetWidget = function VeUiMWTargetWidget( config ) {
|
2022-07-18 13:12:10 +00:00
|
|
|
this.surfaceClasses = ve.copy( config.surfaceClasses ) || [];
|
|
|
|
|
|
|
|
// HACK: T287733
|
|
|
|
// This assumes the target widget is being shown outside of vector-body, otherwise this
|
|
|
|
// will apply the class a second time and cause problems.
|
|
|
|
if ( mw.config.get( 'skin' ) === 'vector' || mw.config.get( 'skin' ) === 'vector-2022' ) {
|
|
|
|
this.surfaceClasses.push( 'vector-body' );
|
|
|
|
}
|
2021-05-17 21:39:22 +00:00
|
|
|
|
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,
|
|
|
|
modes: this.modes,
|
2021-05-17 21:39:22 +00:00
|
|
|
defaultMode: this.defaultMode,
|
|
|
|
surfaceClasses: this.surfaceClasses
|
2019-10-09 13:55:40 +00:00
|
|
|
} );
|
|
|
|
};
|