2013-12-02 20:10:55 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor user interface MWTransclusionContentPage class.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2013-12-02 20:10:55 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2022-07-12 09:55:54 +00:00
|
|
|
* Template dialog content pane input for a raw wikitext snippet.
|
2013-12-02 20:10:55 +00:00
|
|
|
*
|
|
|
|
* @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
|
2024-05-27 04:59:02 +00:00
|
|
|
* @param {jQuery} [config.$overlay] Overlay to render dropdowns in
|
|
|
|
* @param {boolean} [config.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 */
|
|
|
|
|
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
|
|
|
};
|