2013-12-02 20:10:55 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor user interface MWTransclusionContentPage class.
|
|
|
|
*
|
2020-01-08 17:13:04 +00:00
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
2013-12-02 20:10:55 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki transclusion dialog content page.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.PageLayout
|
|
|
|
*
|
|
|
|
* @constructor
|
2021-06-04 10:16:58 +00:00
|
|
|
* @param {ve.dm.MWTransclusionContentModel} content
|
2013-12-02 20:10:55 +00:00
|
|
|
* @param {string} name Unique symbolic name of page
|
|
|
|
* @param {Object} [config] Configuration options
|
2018-04-04 20:37:32 +00:00
|
|
|
* @cfg {jQuery} [$overlay] Overlay to render dropdowns in
|
2019-02-24 12:38:03 +00:00
|
|
|
* @cfg {boolean} [isReadOnly] Page is read-only
|
2013-12-02 20:10:55 +00:00
|
|
|
*/
|
2014-02-28 00:00:10 +00:00
|
|
|
ve.ui.MWTransclusionContentPage = function VeUiMWTransclusionContentPage( content, name, config ) {
|
2014-04-25 23:50:21 +00:00
|
|
|
// Configuration initialization
|
|
|
|
config = ve.extendObject( {
|
2014-08-22 20:50:48 +00:00
|
|
|
scrollable: false
|
2014-04-25 23:50:21 +00:00
|
|
|
}, config );
|
|
|
|
|
2013-12-02 20:10:55 +00:00
|
|
|
// Parent constructor
|
2016-08-22 21:44:59 +00:00
|
|
|
ve.ui.MWTransclusionContentPage.super.call( this, name, config );
|
2013-12-02 20:10:55 +00:00
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.content = content;
|
2018-08-07 11:39:14 +00:00
|
|
|
this.textInput = new ve.ui.MWLazyMultilineTextInputWidget( {
|
2014-08-22 20:50:48 +00:00
|
|
|
autosize: true,
|
|
|
|
classes: [ 've-ui-mwTransclusionDialog-input' ]
|
2014-06-26 10:41:18 +00:00
|
|
|
} )
|
2021-06-17 16:17:54 +00:00
|
|
|
.setValue( this.content.serialize() )
|
2019-02-24 12:38:03 +00:00
|
|
|
.setReadOnly( config.isReadOnly )
|
2014-08-22 20:50:48 +00:00
|
|
|
.connect( this, { change: 'onTextInputChange' } );
|
2013-12-02 20:10:55 +00:00
|
|
|
this.valueFieldset = new OO.ui.FieldsetLayout( {
|
2022-06-17 09:35:11 +00:00
|
|
|
label: ve.msg( 'visualeditor-dialog-transclusion-wikitext' ),
|
2015-11-04 14:15:29 +00:00
|
|
|
icon: 'wikiText',
|
2014-08-22 20:50:48 +00:00
|
|
|
$content: this.textInput.$element
|
2013-12-02 20:10:55 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
// Initialization
|
2014-02-28 01:18:49 +00:00
|
|
|
this.$element
|
|
|
|
.addClass( 've-ui-mwTransclusionContentPage' )
|
2019-02-24 12:38:03 +00:00
|
|
|
.append( this.valueFieldset.$element );
|
2013-12-02 20:10:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWTransclusionContentPage, OO.ui.PageLayout );
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2014-02-15 01:37:32 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2021-09-15 10:10:56 +00:00
|
|
|
ve.ui.MWTransclusionContentPage.prototype.setupOutlineItem = function () {
|
|
|
|
this.outlineItem
|
2022-06-20 08:39:45 +00:00
|
|
|
// Basic properties to make the OO.ui.OutlineControlsWidget buttons behave sane
|
2021-09-15 10:10:56 +00:00
|
|
|
.setMovable( true )
|
2022-06-17 09:35:11 +00:00
|
|
|
.setRemovable( true );
|
2014-02-15 01:37:32 +00:00
|
|
|
};
|
|
|
|
|
2021-09-17 09:29:50 +00:00
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
*/
|
2013-12-02 20:10:55 +00:00
|
|
|
ve.ui.MWTransclusionContentPage.prototype.onTextInputChange = function () {
|
2021-06-04 10:16:58 +00:00
|
|
|
this.content.setWikitext( this.textInput.getValue() );
|
2013-12-02 20:10:55 +00:00
|
|
|
};
|