mediawiki-extensions-Visual.../modules/ve-mw/dm/models/ve.dm.MWTransclusionContentModel.js
Thiemo Kreuz 8d7c55aa71 Rename "value" to "wikitext" in TransclusionContent… classes
This class represents a raw wikitext snippet. There is also no
base class that would require us to follow a generic
getValue/setValue naming scheme.

Change-Id: I0891a2f6c0ae0121429a47c39221e99b9653e8e3
2021-06-08 09:27:47 +02:00

66 lines
1.3 KiB
JavaScript

/*!
* VisualEditor DataModel MWTransclusionContentModel class.
*
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* MediaWiki transclusion content model.
*
* @class
* @extends ve.dm.MWTransclusionPartModel
*
* @constructor
* @param {ve.dm.MWTransclusionModel} transclusion
* @param {string} [wikitext='']
*/
ve.dm.MWTransclusionContentModel = function VeDmMWTransclusionContentModel( transclusion, wikitext ) {
// Parent constructor
ve.dm.MWTransclusionContentModel.super.call( this, transclusion );
// Properties
this.wikitext = wikitext || '';
};
/* Inheritance */
OO.inheritClass( ve.dm.MWTransclusionContentModel, ve.dm.MWTransclusionPartModel );
/* Events */
/**
* @event change
*/
/* Methods */
/**
* @param {string} wikitext
*/
ve.dm.MWTransclusionContentModel.prototype.setWikitext = function ( wikitext ) {
this.wikitext = wikitext;
this.emit( 'change' );
};
/**
* @inheritdoc
*/
ve.dm.MWTransclusionContentModel.prototype.serialize = function () {
return this.wikitext;
};
/**
* @inheritdoc
*/
ve.dm.MWTransclusionContentModel.prototype.getWikitext = function () {
return this.wikitext;
};
/**
* @inheritDoc
*/
ve.dm.MWTransclusionContentModel.prototype.isEmpty = function () {
return this.wikitext === '';
};