2013-06-11 19:16:04 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel MWTransclusionContentModel class.
|
|
|
|
*
|
2016-01-03 22:56:59 +00:00
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
2013-06-11 19:16:04 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki transclusion content model.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.dm.MWTransclusionPartModel
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.dm.MWTransclusionModel} transclusion Transclusion
|
|
|
|
* @param {string} [value] Content value
|
|
|
|
*/
|
2013-07-12 00:23:33 +00:00
|
|
|
ve.dm.MWTransclusionContentModel = function VeDmMWTransclusionContentModel( transclusion, value ) {
|
2013-06-11 19:16:04 +00:00
|
|
|
// Parent constructor
|
2013-07-12 00:23:33 +00:00
|
|
|
ve.dm.MWTransclusionPartModel.call( this, transclusion );
|
2013-06-11 19:16:04 +00:00
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.value = value || '';
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-10-11 21:44:09 +00:00
|
|
|
OO.inheritClass( ve.dm.MWTransclusionContentModel, ve.dm.MWTransclusionPartModel );
|
2013-06-11 19:16:04 +00:00
|
|
|
|
2013-12-09 19:05:57 +00:00
|
|
|
/* Events */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @event change
|
|
|
|
*/
|
|
|
|
|
2013-06-11 19:16:04 +00:00
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get content value.
|
|
|
|
*
|
2015-08-19 18:09:34 +00:00
|
|
|
* @return {string} Content value
|
2013-06-11 19:16:04 +00:00
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionContentModel.prototype.getValue = function () {
|
|
|
|
return this.value;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set content value.
|
|
|
|
*
|
|
|
|
* @param {string} value Content value
|
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionContentModel.prototype.setValue = function ( value ) {
|
|
|
|
this.value = value;
|
2013-12-09 19:05:57 +00:00
|
|
|
this.emit( 'change' );
|
2013-06-11 19:16:04 +00:00
|
|
|
};
|
2013-07-12 00:23:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionContentModel.prototype.serialize = function () {
|
2013-12-09 19:05:57 +00:00
|
|
|
return this.value;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.getWikitext = function () {
|
|
|
|
return this.value;
|
2013-07-12 00:23:33 +00:00
|
|
|
};
|