mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 02:51:50 +00:00
8d7c55aa71
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
66 lines
1.3 KiB
JavaScript
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 === '';
|
|
};
|