mediawiki-extensions-Visual.../modules/ve-mw/ui/widgets/ve.ui.MWTargetWidget.js
Thiemo Kreuz aa556e3ef8 Update and fix all @param config and @cfg documentation
I tried to review all of them. Some of the changes I did:
* Make sure the `config` parameter is not marked as optional
  when it is not.
* Make sure default values are mentioned.
* List individual `@cfg` options when it makes sense.

Note I don't list all options a class could accept (e.g. via all
its parent classes and mixins). That's too much. Instead I checked
how a class is actually used and list only these options.

Even then I don't list everything, e.g. unspecific options
like "classes" that can be used pretty much everywhere.

Change-Id: Idf4fbe1dc3608ace277df9e385f2f140df3a2f50
2021-09-12 12:35:27 +00:00

45 lines
1,015 B
JavaScript

/*!
* VisualEditor UserInterface MWTargetWidget class.
*
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.MWTargetWidget object.
*
* @class
* @abstract
* @extends ve.ui.TargetWidget
*
* @constructor
* @param {Object} config
* @cfg {string[]} [surfaceClasses] Surface classes to apply
*/
ve.ui.MWTargetWidget = function VeUiMWTargetWidget( config ) {
this.surfaceClasses = config.surfaceClasses;
// Parent constructor
ve.ui.MWTargetWidget.super.apply( this, arguments );
// Initialization
this.$element.addClass( 've-ui-mwTargetWidget' );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWTargetWidget, ve.ui.TargetWidget );
/**
* @inheritdoc
*/
ve.ui.MWTargetWidget.prototype.createTarget = function () {
return new ve.init.mw.Target( {
register: false,
toolbarGroups: this.toolbarGroups,
modes: this.modes,
defaultMode: this.defaultMode,
surfaceClasses: this.surfaceClasses
} );
};