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
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright 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 ) || [];
|
|
|
|
|
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
|
|
|
} );
|
|
|
|
};
|