mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-04 18:58:37 +00:00
4da31e7c9e
New changes: 4af3f84f7 Mark surface as "showAsDeactivated" when opening a window 79eb0e4e5 ve.ce.Surface: Guard against focusing a un-initialized surface 4124c275e [BREAKING CHANGE] ve.ui.TargetWidget: Construct a real target inside the widget Local changes: * Use new target widget * Remove calls to deprecated methods * 'surfaceReady' event was upstreamed Bug: T236400 Change-Id: I765d657c172d96c3b2e2ae5998083e4926a31f15
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWTargetWidget class.
|
|
*
|
|
* @copyright 2011-2019 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] Configuration options
|
|
*/
|
|
ve.ui.MWTargetWidget = function VeUiMWTargetWidget() {
|
|
// 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,
|
|
inTargetWidget: true,
|
|
modes: this.modes,
|
|
defaultMode: this.defaultMode
|
|
} );
|
|
};
|
|
|
|
/**
|
|
* @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
|
|
this.getSurface().getView().$element.addClass( 'mw-body-content' );
|
|
this.getSurface().$placeholder.addClass( 'mw-body-content' );
|
|
};
|