2013-06-11 19:16:04 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel MWTransclusionPartModel class.
|
|
|
|
*
|
2017-01-03 16:58:33 +00:00
|
|
|
* @copyright 2011-2017 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 part model.
|
|
|
|
*
|
|
|
|
* @class
|
2013-10-15 11:58:04 +00:00
|
|
|
* @mixins OO.EventEmitter
|
2013-06-11 19:16:04 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.dm.MWTransclusionModel} transclusion Transclusion
|
|
|
|
*/
|
2013-07-12 00:23:33 +00:00
|
|
|
ve.dm.MWTransclusionPartModel = function VeDmMWTransclusionPartModel( transclusion ) {
|
2013-06-11 19:16:04 +00:00
|
|
|
// Mixin constructors
|
2013-10-15 11:58:04 +00:00
|
|
|
OO.EventEmitter.call( this );
|
2013-06-11 19:16:04 +00:00
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.transclusion = transclusion;
|
2013-06-18 19:39:21 +00:00
|
|
|
this.id = 'part_' + this.transclusion.getUniquePartId();
|
2013-06-11 19:16:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-10-15 11:58:04 +00:00
|
|
|
OO.mixinClass( ve.dm.MWTransclusionPartModel, OO.EventEmitter );
|
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 transclusion part is in.
|
|
|
|
*
|
2015-08-19 18:09:34 +00:00
|
|
|
* @return {ve.dm.MWTransclusionModel} Transclusion
|
2013-06-11 19:16:04 +00:00
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.getTransclusion = function () {
|
|
|
|
return this.transclusion;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a unique part ID within the transclusion.
|
|
|
|
*
|
2015-08-19 18:09:34 +00:00
|
|
|
* @return {string} Unique ID
|
2013-06-11 19:16:04 +00:00
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.getId = function () {
|
|
|
|
return this.id;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove part from transclusion.
|
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.remove = function () {
|
|
|
|
this.transclusion.removePart( this );
|
|
|
|
};
|
2013-07-12 00:23:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get serialized representation of transclusion part.
|
|
|
|
*
|
2015-08-19 18:09:34 +00:00
|
|
|
* @return {Mixed} Serialized representation, or undefined if empty
|
2013-07-12 00:23:33 +00:00
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.serialize = function () {
|
|
|
|
return undefined;
|
|
|
|
};
|
2013-12-09 19:05:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the wikitext for this part.
|
|
|
|
*
|
2015-08-19 18:09:34 +00:00
|
|
|
* @return {string} Wikitext
|
2013-12-09 19:05:57 +00:00
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.getWikitext = function () {
|
|
|
|
return '';
|
|
|
|
};
|
2016-05-13 19:43:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add all non-existing required and suggested parameters, if any.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @return {number} Number of parameters added
|
|
|
|
*/
|
|
|
|
ve.dm.MWTransclusionPartModel.prototype.addPromptedParameters = function () {
|
|
|
|
return 0;
|
|
|
|
};
|